Occasionally it might be interesting to know whether your current PowerShell session is running in 64-bit. This tip describes how to determine this and how to start either a 32 or 64-bit session of PowerShell. To quickly determine if you current PowerShell session is 32 or 64-bit use the following code:
There are two possible results from this code:
Keep this in mind, especially if you intend to execute memory dependent tasks in Powershell, the testing if the script is executing in a 64 bit context is a good idea.
If a system is 64-bit the following two paths are available for the PowerShell executable:
- C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\powershell.exe (32-bit)
- C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe (64-bit)
Today’s tip is on how to use the Get-OUWithGPOLink funtion in combination with the Get-ADOrganizationalUnit cmdlet. The output of ADOrganizational unit is updated with a new property, FriendlyGPODisplayName. The article is available on PowerShell Magazine:
The full script is also available in the TechNet Script Gallery, Get-OUWithGPO.ps1, at the following link:
Today’s tip is on how to use the Type property of the Win32_Share class to select only non-administrative shares from a local or remote system. This class can be used in combination with the Get-WmiObject or Get-CimInstance cmdlets to gather this data. The examples in this articles show how this can be used against a remote system. The article is available on PowerShell Magazine:
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:
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:
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:
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
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:
This article and many other articles I have written for other websites are available in the External Articles section of this blog.