New article on PowerShell Magazine: Enumerating mapped network drives using WScript.Network

The Wscript.Network COM object offers a variety of useful methods, in a previous tip I showed how to map a network drive and how to remove a mapped network drive. Today the EnumNetworkDrives method will be used to enumerate the currently mapped network drives. A tip on how to enumerate mapped network drives using the EnumNetworkDrives method is available on PowerShell Magazine:

http://www.powershellmagazine.com/2014/07/23/pstip-enumerating-mapped-network-drives-using-wscript-network/

For this article I have written a script that converts the output from this method into PowerShell objects. The script, Get-MappedDrive, is available in the Technet Script Gallery:
http://gallery.technet.microsoft.com/Get-MappedDrive-Get-list-f454b048

New article on PowerShell Magazine: Rename a local or a mapped drive using Shell.Application

In PowerShell it is possible to rename mapped network drives and local disk drives. This can be achieved by using the Shell.Application class. A tip on how to rename a drive using this method has been posted on PowerShell Magazine:

http://www.powershellmagazine.com/2014/07/22/pstip-rename-a-local-or-a-mapped-drive-using-shell-application/

PowerShell DSC Resource Kit Wave 5 has been released

Today the PowerShell team announced that the latest iteration of their Desired State Configuration Resource Kit has been released. This is an experimental resource that is intended for lab and testing purposes. The latest version is available in the Technet Script Gallery:

DSC Resource Kit (All Modules)

Depending on which modules you will be using this resource kit either requires Server 2012 R2/Windows 8.1 with PowerShell 4.0. The xJEA module requires installation of the Windows Management Framework 5.0 Preview.

The original announcement by the PowerShell Team is available here:
PowerShell DSC Resource Kit Wave 5 Arrives

New article on PowerShell Magazine: Create mapped network drive using WScript.Network

In PowerShell there are several methods available to created mapped drives, one of these is by using the MapNetworkDrive method of Wscript.Network COM object. A tip on how to map a drive using this method which also includes how to remove the mapped folder is available on PowerShell Magazine:

http://www.powershellmagazine.com/2014/07/21/pstip-create-mapped-network-drive-using-wscript-network/

This article and many other articles I have written for other websites are available in the External Articles section of this blog.

Setting up PowerShell Remoting using winrm quickconfig or Enable-PSRemoting fails

A common problem on laptops or mobile workstations is that the initial PowerShell Remoting configuration will fail because the system is connected to a public network. The advice is to change the network from public to private, unfortunately this is not always possible because of WiFi connections.

There is a work around available for this, by running the following code:

Enable-PSRemoting -SkipNetworkProfileCheck -Force

By including the -SkipNetworkProfileCheck the cmdlet with omit the network check and PowerShell remoting correctly regardless of the fact that the system might be connected to a public network.

When setting up PowerShell Remoting using winrm quickconfig the following error might occur:

PS C:\WINDOWS\system32> winrm quickconfig  quests on this machine.
The following changes must be made:

Start the WinRM service.
Set the WinRM service type to delayed auto start.

Make these changes [y/n]? y

WinRM has been updated to receive requests.

WinRM service type changed successfully.
WinRM service started.
WSManFault
Message
ProviderFault
WSManFault
Message = WinRM firewall exception will not work since one of the network connection types on this machi
ne is set to Public. Change the network connection type to either Domain or Private and try again.

Error number: -2144108183 0x80338169
WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Chang
e the network connection type to either Domain or Private and try again.

Or when using Enable-PSRemoting without skip network check this error will appear:

PS C:\WINDOWS\system32> Enable-PSRemoting -force

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="computername"><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:69 char:17
+ Set-WSManQuickConfig -force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand