Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Problems with @ComSpec, 'net user' and DriveMapAdd

$
0
0
Can anyone tell me why this isn't working?  I've included the debug code also.

#include <File.au3> ; Not necessary for the block in question, but the goal of the script is to create some directories and install programs.
#RequireAdmin

;Set up Administrator account and map necessary Drive

$cmd = 'net user administrator /active:yes'
RunWait (@ComSpec &'/k' & $cmd) ; @error = 1, @extended = 2
$pwd = 'net user administrator password' @error = 1, @extended = 2
RunWait (@ComSpec &'/k' & '$pwd') ; @error = 1, @extended = 2
DriveMapAdd ('j:', '\\server\share', 'administrator', 'password') ; @error = 6, @extended = 0 <== ostensibly so since the administrator is never getting set on line 3.


I really appreciate your help!

Edit: Added #RequireAdmin - Same result.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>