Prodigus Posted June 15, 2006 Posted June 15, 2006 $sCmd2run = 'psexec \\'& $var1 & 'net localgroup administrators /add' '"sleh\'&$var2"' $sErrorStatus = RunWait($sCmd2Run, @ScriptDir, @SW_HIDE) I just can't seem to get all my ' and " in the right place on this one.... GRRRRRR
NELyon Posted June 15, 2006 Posted June 15, 2006 hmm... don't know the problem with the code but it looks to me like someone is trying to get himself administrative(sp?) rights on his computer...XD
PsaltyDS Posted June 16, 2006 Posted June 16, 2006 (edited) $sCmd2run = 'psexec \\'& $var1 & 'net localgroup administrators /add' '"sleh\'&$var2"' $sErrorStatus = RunWait($sCmd2Run, @ScriptDir, @SW_HIDE) I just can't seem to get all my ' and " in the right place on this one.... GRRRRRR Missing an ampersand and a space after /add, and you have an odd count of single-quotes: $sCmd2run = 'psexec \\' & $var1 & 'net localgroup administrators /add "sleh\' & $var2 & '"' $sErrorStatus = RunWait($sCmd2Run, @ScriptDir, @SW_HIDE) Your command parts (in single quotes) are: 'psexec \\' $var1 'net localgroup administrators /add "sleh\' $var2 '"' (a double-quote within single-quotes) Edited June 16, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
PsaltyDS Posted June 16, 2006 Posted June 16, 2006 hmm... don't know the problem with the code but it looks to me like someone is trying to get himself administrative(sp?) rights on his computer...XDPSEXEC is not exactly a hack, becuase you have to authenticate for any operation performed. It is however a security problem, because it passes all parameters (including passwords) in clear text. This is not a problem if you are logged in to a domain or an identical account on the computer sending the PSEXEC command as an admin on the target, and don't have to pass any password over the commmand line, such as to add a user to a group. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Prodigus Posted June 16, 2006 Author Posted June 16, 2006 Thank You! It's a function of a script I'm writing to gather all of my servers names from AD (about 300) then create Global Groups for each of them to contain the local admins. This is just to add each of those global groups to the local admins group on each server.... Then populate the global group with the domain users who are now members of the local groups. I want to be able to manage local admins from a higher level is all... Thanks again!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now