111945
Goto Top

Powershell - DISK - Als Administrator ausführen

Hallo Zusammen,

ich habe ein kleines Problem mit Powershell.

Ziel ist ein Task, der ein Skript öffnet, dass auf ein weiteres Skript verweist. Mein Problem ist, dass beim Verweis im StartSkript die Admin-Rechte nicht zum dismskript übertragen werden.

z.B.

Task (Erstellt "Mit höchsten Berechtigungen ausführen"
powershell.exe -arguments -file "C:\Startskript.ps1"  

Startskript.ps1:
# Dieses Skript führt ein weiteres Skript aus

Set-Location C:\

$MeinArray | .\dismskript.ps1

dismskript.ps1
dism /mount-image /ImageFile:"C:\WindowsImage.iso" /MountDir:$("D:\" + "DISMMOUNT") /index:1  | out-null  

Jemand eine Lösung?

Danke

Content-Key: 333448

Url: https://administrator.de/contentid/333448

Printed on: April 26, 2024 at 04:04 o'clock

Mitglied: 132692
Solution 132692 Mar 28, 2017 at 14:37:40 (UTC)
Goto Top
Mitglied: 111945
111945 Mar 28, 2017 updated at 15:06:45 (UTC)
Goto Top
$ScriptPath =  "D:\Start_Create_VM.ps1"  
$RelaunchArgs = '-ExecutionPolicy Unrestricted -file "' + $ScriptPath + '" -IsRunAsAdmin'  
$AdminProcess = Start-Process "$PsHome\PowerShell.exe" -Verb RunAs -ArgumentList $RelaunchArgs -PassThru