How to not run second command when first command failed
hi
i've got script 2 commands. how not run second command if first faild?
for example:
move-vmstorage -computername $vmnodename -vmname $vmname -destinationstoragepath $path
remove-item -path $oldpath -recurse -include *.vhd*
how stop running command (avoid) "remove-item -path $oldpath -recurse -include *.vhd*" if first command
"move-vmstorage -computername $vmnodename -vmname $vmname -destinationstoragepath $path" faild (i've got an error)?
so how to change script?
thank mouch help!!!
kind regards tomasz
move-vmstorage -computername $vmnodename -vmname $vmname -destinationstoragepath $path
if($?){remove-item -path $oldpath -recurse -include *.vhd}
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment