Posts From February, 2015

PowerShell install version 4

PowerShell 4.0 added many features, but the one that mattered to me was the -append flag when exporting to csv. With this flag, if the csv file exists, then the rows of info are appended, if the file doesn't exist, then the file is created. While this could be done in older versions, that simple logic basically meant writing code to trap the file exist issue and then branch to the right export command.

So, the question becomes, how do you upgrade to PowerShell 4.0? Do you even have PowerShell 4.0? How do you tell what PowerShell version you have?
To determine the PowerShell engine version, use $PSVersionTable.PSVersion at the PowerShell command prompt. If this command doesn't work from the PowerShell command prompt, then the installed PowerShell is version 1.

Not sure whether PowerShell is installed because it doesn't show up in the Start menu? Well, you could check the registry -- HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell ... the version would come after that. Microsoft further explains the expected registry entries in this blog:

Me, I prefer working with the Windows PowerShell ISE, but the above command can also run from the PowerShell command line (kinda looks like a DOS window). Both options should show up by typing in PowerShell from the Start button then selecting the verison you want -  Windows PowerShell ISE or Windows PowerShell (command line version).  If you like the ISE like I do, then from the Start button type in ISE to get to the two versions (x86 which I don't use, and Windows PowerShell ISE (my preference). 

Here is the link from Microsoft -- Installing version 4 of PowerShell also updates features of the Windows Management Framework to version 4.0.

Another tidbit -- even with PowerShell installed, PC's typically are shipped with 'Execution Policies' not enabled for scripts to be run.  To modify this setting, a regedit is required. 

run PowerShell as administrator, then run the following command: Set-ExecutionPolicy RemoteSigned

Update - install Active Directory for PowerShell module in order to query Active Directory
Easiest way to install AD module is to run the following PowerShell command for Windows 8 and prior:  Add-WindowsFeature RSAT-AD-PowerShell

For Windows 10, download a package and install it with elevated privileges - instructions found here.

Further info on AD module installation: is where you'll find the Remote Server Administration for Windows 7 download, then follow the instructions found here -

Copyright© Brad Earle
Site Map | Printable View | © 2008 - 2021 KB Earle Associates LLC | |