我一直试图通过Powershell运行DISM但是我似乎在将一个变量从Powershell传递给DISM时遇到了问题。如果有更好的方法将我的驱动器号$ dl传递给DISM,我愿意接受建议。
$dl=(Mount-DiskImage -ImagePath "\\domain\shares$\IT\ISO\Desktops\Microsoft\SW_DVD5_WIN_EDU_10_1703_64BIT_English_MLF_X21-36554.ISO" -PassThru | Get-Volume).DriveLetter
RunAs /user:domain\svcaccount (Dism /online /enable-feature /featurename:NetFX3 /All /Source:{$dl}:\sources\sxs /LimitAccess)
答案 0 :(得分:0)
将整个参数转换为单个字符串。
$dl = $dl + ':\sources\sxs'
RunAs /user:domain\svcaccount (Dism /online /enable-feature /featurename:NetFX3 /All /Source:$dl /LimitAccess)