I cannot seem to get the "USE" command to work with variables. If I try typing net use in a command prompt, it works. If I try typing out the command without variables in my script, it works. But it does not work with variables.
Heres part of my code:
Code:
$string = '* "' + $share + '" ' + '/user:' + $user + ' /persistent:yes'
Use $string
? "Result: " + @RESULT + ", Error: " + @ERROR
This script is called from another script (I'm doing this to run it as an admin instead of a normal user).
Code:
$RunAsLocalAdmin = 'lsrunase.exe /user:admin /domain:@WKSTA /password:encrypted '
Shell $RunAsLocalAdmin + '/runpath:' + $runpath + ' /command:"kix32.exe network.kix $share=\\server\share $user=nobody"'
I have echoed the variable $string before the USE statement and it looks fine to me, even has the quotes around the share name. There is no result returned, obviously, and the error returned is 67. I have also tried using: Execute( 'USE $string' ), but that didn't work either. I am quite stumped, anyone have any ideas?
Thanks for the assistance.