Deploying PowerShell v3

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Adam Bertram Adam Bertram 2 years, 6 months ago.

  • Author
    Posts
  • #16108
    Profile photo of Bojan Zivkovic
    Bojan Zivkovic
    Participant

    Hi, all workstations in my domain are running Windows 7 Professional with SP1 (x86 and x64). I would like to deploy PS version 3 to all of them (assuming that WMF 3 would have to be deployed in fact and with it PS 3 as part of WMF 3), since I can not use PS version 4 due to .NET Framework 4.5 requirement and my core banking software uses .NET Framework 4 and has issues when 4.5 is on a computer. Which is the most effective way of doing this (WSUS, Group Policy, . . .) and is there any Microsoft documentation how to implement this?

    I read this on Microsoft so it seems WMF 3 can be deployed as KB via WSUS?

    To install Windows Management Framework 3.0: 1.Download the correct package for your operating system and architecture.

    •Windows 7 Service Pack 1

    •64-bit versions: Windows6.1-KB2506143-x64.msu
    •32-bit versions: Windows6.1-KB2506143-x86.msu

    Thanks in advance!

  • #16110
    Profile photo of Adam Bertram
    Adam Bertram
    Participant

    This is a VBscript that I used to use when getting Powershell out to my clients. I have ConfigMgr so I deployed it that way but this could just as easily be put into a login/startup script or some other preferred method. It firsts checks to ensure it doesn't have the appropriate version already. If not, it'll then install either the x86 or x64 version depending on the architecture of the client. 6.0.6002.18111 is the file version for PSv2. To get the file version for PSv3, just go to the properties of powershell.exe on something that has v3 installed and go to the Details tab.

    I also enabled remoting as I was doing installs as well. You can remove that if you wish.

    Set oShell = WScript.CreateObject("WScript.Shell")
    Set oFso = CreateObject("Scripting.FileSystemObject")
    strWorkingDir = oFso.GetParentFolderName(wscript.ScriptFullName)
    
    Set swbemLocator = CreateObject("WbemScripting.SWbemLocator")
    Set swbemServices = swbemLocator.ConnectServer(".", "Root\CIMV2")
    
    if oFSO.GetFileVersion("c:\windows\system32\windowspowershell\v1.0\powershell.exe") = "6.0.6002.18111" then
    	Set colArchs = swbemServices.ExecQuery("SELECT SystemType FROM Win32_ComputerSystem",,48)
    	For Each objArch in colArchs
    		If InStr(objArch.SystemType,"X86-based PC") > 0 Then
    			oShell.Run "wusa.exe " & strWorkingDir & "\Windows6.1-KB2506143-x86.msu /quiet /norestart",0,True
    		ElseIf InStr(objArch.SystemType,"x64-based PC") > 0 Then
    			oShell.Run "wusa.exe " & strWorkingDir & "\Windows6.1-KB2506143-x64.msu /quiet /norestart",0,True
    		Else
    			Wscript.Quit(10)
    		End If
    	Next
    end if
    
    oShell.Run "winrm quickconfig -quiet",0,True

You must be logged in to reply to this topic.