Tech Short: PowerShell: Networking Diagnostics

Listen ‘tracert’ its not you, its me…  I am not ending my long term relationship with the diagnostic tools which I have used for many years now.  I am just exploring others, and in doing so going on a “break”.

I recently starting using PowerShell more often and wondered is there a tool which can do what ‘tracert‘ does and maybe more.

This is where the PowerShell command  Test-NetConnection comes into the picture.

It does many of the functions of tracert which an out-put which at this point I favor far more.

Here are some examples:

Here is an example of using Test-NetConnection to test connectivity to jermsmit.com

ComputerName : jermsmit.com
RemoteAddress :
InterfaceAlias : Wi-Fi
SourceAddress :
PingSucceeded : True
PingReplyDetails (RTT) : 80 ms


Same test as above using the –TraceRoute flag return the list of hosts on the path to the specified target jermsmit.com

ComputerName : jermsmit.com
RemoteAddress :
InterfaceAlias : Wi-Fi
SourceAddress :
PingSucceeded : True
PingReplyDetails (RTT) : 82 ms
TraceRoute :

As you can see form the examples its a very useful tool in PowerShell, also giving you information about which network interface you are testing from.

What I have also found out is there is an alias for  Test-NetConnection. To use this all you need to do is simply type ‘tnr‘ following by the command syntax.

For more info on using Test-NetConnection type: Help Test-NetConnection in the PowerShell command prompt – Results may looking similar to what I have shown below:




 I hope you enjoyed this techshort, thanks for visiting – jermal


Disable Windows Firewall Server Core

Server Core now installed and what is the first command I choose to run in PowerShell

Its a command to disable all firewall profiles:


Error: Setting up PowerShell Remoting

In an attempt to connect to a remote Hyper-V host I needed to enable PowerShell Remoting.

To enable this you simple run PowerShell as Administrator and issue the following command:

The command runs and then errors with the following output:

PS C:\WINDOWS\system32> Enable-PSRemoting

WinRM has been updated to receive requests.
WinRM service type changed successfully.
WinRM service started.

Set-WSManQuickConfig : <f:WSManFault xmlns:f=”http://schemas.microsoft.com/wbem/wsman/1/wsmanfault” Code=”2150859113″ Machine=”localhost”><f:Message><f:ProviderFault
provider=”Config provider” path=”%systemroot%\system32\WsmSvc.dll”><f:WSManFault xmlns:f=”http://schemas.microsoft.com/wbem/wsman/1/wsmanfault” Code=”2150859113″
Machine=”workstation.jermsmit.com”><f:Message>WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change
the network connection type to either Domain or Private and try again. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:116 char:17
+ Set-WSManQuickConfig -force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

To correct this I opened another PowerShell window, also running as Administrator issue the following command to change each of the network interfaces to be private.


At this point I was able to run the Enable-PSRemoting without error

PS C:\WINDOWS\system32> Enable-PSRemoting
WinRM is already set up to receive requests on this computer.
WinRM has been updated for remote management.
Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.
WinRM firewall exception enabled.


TechShort: PowerShell to Setup VPN Connections

Here is a way we can be consistent with our setup of VPN connections on computers.

Using PowerShell this is made simple with a small script on a USB stick, network share or whatever method you choose to get the to the client machine

The following is a one line PowerShell command:

Next is to see if this can be placed in a group policy to have it automated on end user computers

I hope this helps your process of machine setups.

– Jermal

Ref: https://technet.microsoft.com/en-us/%5Clibrary/JJ554820(v=WPS.630).aspx

Tech Short: “execution of scripts is disabled on this system.”

Attempting to run a PowerShell script I got the following error:

File C:\Work\ps.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
+ CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnauthorizedAccess

To run PowerShell scripts (files that end with .ps1), you must set the execution policy to Unrestricted. This is done by issuing the following command in powersehll

*note* you need to do this in a elevated powershell (run it as administrator)

Once you do that, Windows will allow you to execute any .ps1 file.