> For the complete documentation index, see [llms.txt](https://baric6.gitbook.io/barics-knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://baric6.gitbook.io/barics-knowledge-base/development/ad-ps-commands/network-powershell-commands.md).

# Network Powershell Commands

To flush dns

```
$ ipconfig /flushdns
```

To register new dns

```
$ ipconfig /registerdns
```

Get gpo policy of local pc

```
$ gpresult /r /scope:computer
```

Update gpo policy

```
$ gpupdate /result
```

Network data:

```
$ Get-NetIPConfiguration
```

List all network adapters

```
$ Get-NetAdapter
```

Get adapter by name

```
$ Get-NetAdapter -Name Ethernet
```

Get more data on adapter

```
$ Get-NetAdapter | ft Name, Status, Linkspeed, VlanID
```

Get network driver

```
$ Get-NetAdapter | ft Name, DriverName, DriverVersion, DriverInformation, DriverFileName 
```

Disable and enable network adapter

```
$ Disable-NetAdapter -Name "Wireless Network Connection"
$ Enable-NetAdapter -Name "Wireless Network Connection"
```

Get IP and Dns info

```
$ Get-NetAdapter -Name "Local Area Connection" | Get-NetIPAdapter
```

Ping

```
$ Test-Connection google.com
```

Better command for ping

```
$ Test-NetConnection -ComputerName www.google.com
```

Tracert

```
$ Test-NetConnection www.google.com -TraceRoute
```

NSlookup in powershell

```
$ Resolve-DnsName www.google.com
$ Resolve-DnsName www.google.com Type MX -Server 8.8.8.8
```

Netstat

```
$ Get-NetTCPConnection
$ Get NetTCPConnection -State Established
```

Remove TWINUI through powershell

```
$ Get-AppXPackage | Foreach {Add-AppxPackage -DisableDevelopmentMode - Register "$($_.InstallLocation)\AppXManifest.xml"}
```
