Jump to content
Sign in to follow this  
DemonAngel

Command Problem

Recommended Posts

DemonAngel

I have a problem with the following code. The problem exists within the command.

; Script Start - Add your code below here
$username = IniRead("settings.ini","ACCOUNTS","username","")
$password = IniRead("settings.ini","ACCOUNTS","password","")

RunAsSet($username,@ComputerName,$password)

$command = @SystemDir &"\net.exe localgroup power users /add " &@LogonDomain &"\" &@UserName

Run($command)

If I replace power users with administrators, it works fine. But because power users is 2 words it tries to add the user to the power group. If I run the command in a dos prompt I would only need to type "power users", but autoit reacts to "".

How should I re-write this command so that it will work?

Share this post


Link to post
Share on other sites
jpm

$command = @SystemDir &'\net.exe localgroup "power users" /add ' &@LogonDomain &"\" &@UserName

Does that work?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.