powershellweb-platform-installer

WebPiCMD.exe with Remote PowerShell Execution when installing .NET Framework 4


Has anybody had any luck using the WebPICmd.exe to automate the installation of .NET Framework 4 remotely. I am trying to do it with PowerShell and it does not seem to be working.

PS C:> ([wmiclass]"\webserver1\root\cimv2:Win32_Process").Create("D:\installer_tools\webpicmd\webpicmd.exe /Install /Products:NETFramework4 /AcceptEula", "D:\installer_tools\webpicmd\")


To add more detail, I keep getting this error:
Exe (C:\Users\rh\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\Windows6.1-KB958488-v6001-x64.msu) failed with 0x5 - Access is denied.


Solution

  • The only way I could get this to work was by using PsExec.exe tools from sysinternals and using /s option to have the process run under the system account. Just thought other people might find this information helpful.

    SysInternals PsTools Download http://technet.microsoft.com/en-us/sysinternals/bb896649

    Option 1 - Using .NET Framework 4 Full Installer

    .\_tools\PsTools\PsExec.exe \\WebServer1 /S /AcceptEula C:\installer\dotNetFx40_Full_x86_x64.exe /q /norestart
    

    Option 2 - Using WebPiCMD.exe

    .\_tools\PsTools\PsExec.exe \\WebServer1 /S /AcceptEula C:\installer\_tools\WebPiCMD\WebPICMD.exe /Install /Products:NetFramework4 /AcceptEula
    

    To download PSExec tools using the following code before one of the options above:

    # Download Psexec
        $psToolsPath = "$env:temp\pstools"
        New-Item $psToolsPath -ItemType directory -force -erroraction silentlycontinue
        Invoke-WebRequest -Uri https://download.sysinternals.com/files/PSTools.zip -OutFile $psToolsPath\PSTools.zip
    
        #Expand and execute as local system
        Expand-Archive "$psToolsPath\PSTools.zip" $psToolsPath -force
        cd $psToolsPath