Powershell Variable ausgabe in Anfürungszeichen. WIe?
Hallo,
ich habe follgenden Powershell Skript
Als Ausgabe schreibt er mir ein Batch Skript, dieser hat follgende Inhalt
Mein Problem ist, dass der Parameter test vm keine Anfürungszeichen hat. Und das brauche ich damit die virtuelle maschine startet.
kann jemand bitte die write-output ausgabe so anpassen, dass die Ausgabe Anfürunszeichen hat?
ich habe follgenden Powershell Skript
$vmname = "$args"
new-item -type directory -path "d:\Logs\$vmname"
$logfile = "D:\logs\$vmname\$vmname.log"
$date = get-date
write-output "VM $vmname wurde hochgefahren $date" >> $logfile
$pfad='"C:\Program Files\HyperVMgt\VMs-MG-Skripte\VM-Shutdown.ps1"'
write-output "cmd /C ECHO . | powershell -f $pfad $vmname" | out-file -encoding ascii "d:\logs\$vmname\startvm.bat"
cmd /C ECHO . | powershell -f "C:\Program Files\HyperVMgt\VMs-MG-Skripte\VM-Shutdown.ps1" test vm
Mein Problem ist, dass der Parameter test vm keine Anfürungszeichen hat. Und das brauche ich damit die virtuelle maschine startet.
kann jemand bitte die write-output ausgabe so anpassen, dass die Ausgabe Anfürunszeichen hat?
Please also mark the comments that contributed to the solution of the article
Content-Key: 175311
Url: https://administrator.de/contentid/175311
Printed on: May 8, 2024 at 02:05 o'clock
7 Comments
Latest comment