安装.NET Framework 4时具有远程PowerShell执行功能的WebPiCMD.exe

时间:2012-03-08 16:57:16

标签: powershell web-platform-installer

是否有人使用WebPICmd.exe远程自动安装.NET Framework 4。我试图用PowerShell做它,它似乎没有工作。

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


要添加更多细节,我不断收到此错误:
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.

2 个答案:

答案 0 :(得分:2)

我能让它工作的唯一方法是使用sysinternals中的PsExec.exe工具并使用/ s选项让进程在系统帐户下运行。只是认为其他人可能会发现这些信息有用。

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

选项1 - 使用.NET Framework 4完整安装程序

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

选项2 - 使用WebPiCMD.exe

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

要在上述选项之一之前使用以下代码下载PSExec工具:

# 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

答案 1 :(得分:0)

要添加roberto的答案(尚无法发表评论),请在其答案之一之前使用以下代码下载PSExec工具:

# 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