|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Net Add LocalGroup - questionHello,
I wanted to implement a script that would add a Domain Group into the local Administrators group. It works fine, except that when it tries to place the Domain Group into the local group and it's already present, it throws an "error" saying that it's already present. I feel confident that this isn't really an error per se, more just a piece of information, but I wanted to see if there were a way in which I could avoid it. Perhaps there's batch code that can check the membership of the group and then go to a different line which would skip the process. Is there such a thing? Any info appreciated. Thanks. - wrote:
Show quoteHide quote > Hello, You can do it by VBscript> > I wanted to implement a script that would add a Domain Group into the > local Administrators group. It works fine, except that when it tries > to place the Domain Group into the local group and it's already > present, it throws an "error" saying that it's already present. I > feel confident that this isn't really an error per se, more just a > piece of information, but I wanted to see if there were a way in > which I could avoid it. Perhaps there's batch code that can check > the membership of the group and then go to a different line which > would skip the process. > Is there such a thing? > > Any info appreciated. > > Thanks. strComputer = "MyComputer" Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group") Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer,user") If objGroup.Exists (objUser.ADsPath) Then WScript.Echo "User already present." Else objGroup.Add(objUser.ADsPath) Wscript.Echo "Operation is done." End If This is only a idea I don't tested it. -- --- Giuseppe Nacci Microsoft Certified System Engineer Security Manager -------------------------------------------------------------------- CONFIDENTIALITY NOTICE This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to supporto.informat***@degennaro.biz Thank you --------------------------------------------------------------------
Scheduler not working properly, having to reset password in job
windows 2000 professional Roll back Going to a specific web page Can't download Security Updates IE Security - Trusted Sites Zone Need some advice on some Required Whiteboard Software. Server Busy the following error occurred attempting to rename the computer ".." Dial-up and Cable Do Not Work remove password request |
|||||||||||||||||||||||