Hi. I am attempting to make a vbs script that I can run off a USB stick on any windows based machine that will open an ADMIN powershell windows and then run this script...
function robocop{clear-host;$confirmation = Read-Host "Data Migration(m)
I have a script that gets me in the admin pwoershell window but i can't use the wshshell.SendKeys command because the script has brackets and quotes that break the code
Does anyone know a way around this?
Thanks in advanced
function robocop{clear-host;$confirmation = Read-Host "Data Migration(m)
n Data Backup (b)
n Exit (e)";if($confirmation -eq 'm'){$mSourceName = Read-Host 'Enter Source Directory.';if(($mSourceName -eq '') -or ($mSourceName -like 'c:')){Write-Warning -Message 'Source directory can not be empty or be C Drive.'}else{$mDestinationName = Read-Host 'Enter Destination Directory.';if($mDestinationName -eq ''){Write-Warning -Message 'Source directory can not be empty.'}else{if(!(test-path $mDestinationName)){New-Item -ItemType Directory -Force -Path $mDestinationName};Robocopy /E /XJ /W:0 /R:0 /ZB /EFSRAW $mSourceName $mDestinationName}}}elseif($confirmation -eq 'b'){$bSourceName = Read-Host 'Enter Source Directory.';if($bSourceName -eq ''){Write-Warning -Message 'Source directory can not be empty.'}else{$bDestinationName = Read-Host 'Enter Destination Directory.';if(($bDestinationName -eq '') -or ($bDestinationName -like 'c:')){Write-Warning -Message 'Destination directory can not be empty or be C Drive.'}else{if(!(test-path $bDestinationName)){New-Item -ItemType Directory -Force -Path $bDestinationName};Robocopy /E /XJ /W:0 /R:0 /ZB /EFSRAW $bSourceName $bDestinationName}}}elseif($confirmation -eq 'e'){break}else{robocop}};robocopI have a script that gets me in the admin pwoershell window but i can't use the wshshell.SendKeys command because the script has brackets and quotes that break the code
Does anyone know a way around this?
Thanks in advanced