0

I have been trying to run DISM via Powershell but I seem to have a problem passing a variable from Powershell to DISM. I am open to suggestions if there is a better way to pass my drive letter $dl to 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)
EBGreen
  • 36,735
  • 12
  • 65
  • 85

1 Answers1

0

Covert the whole argument to a single string.

$dl = $dl + ':\sources\sxs'
RunAs /user:domain\svcaccount (Dism /online /enable-feature /featurename:NetFX3 /All /Source:$dl /LimitAccess)
Minerbob
  • 447
  • 6
  • 14