This script receives a list of computers from a text file and then scans each one to determine if PowerShell is installed. If it is, the script then determines whether it is PowerShell 1.0 or 2.0. The script then returns the results to the screen. There is minimal error handling for cases where either the computer is not reachable or the user executing the script doesn't have proper permissions to read the registry values.

PowerShell
Edit|Remove
$serverListFile = "C:\\scripts\\Servers.txt" 
 
foreach ($serverName in gc $serverListFile) { 
    try  
    { 
        $regHKLMLocation =  [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine"$serverName) 
        $regInstallKey = $regHKLMLocation.OpenSubKey("SOFTWARE\\Microsoft\\PowerShell\\1\\PowerShellEngine") 
        if ($regInstallKey) 
        { 
          if ($regInstallKey.GetValue("PowerShellVersion"-eq "2.0") { 
            Write-Host "$serverName  - OK" 
          } else { 
            Write-Host "$serverName  * Needs PowerShell upgrade! *" 
          } 
        } else { 
          Write-Host "$serverName  ** Needs PowerShell installation! **" 
        } 
    } 
    catch [system.exception] 
    {    
        Write-Host "$serverName  !! Could not read registry value. Check to see if server ($serverName) is up and if you have proper permissions. !!" 
    } 
    finally 
    { 
    } 
     
}