No. Because while the script is psexec'ed with an account in one domain, the machine may in reality be a member of another domain in the forest.
Thanks, Brian Desmond [EMAIL PROTECTED] c - 312.731.3132 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hunter, Laura E. Sent: Sunday, June 19, 2005 4:53 AM To: [email protected]; [email protected] Subject: RE: [ActiveDir] Batch Script Fun Brian, Would the set variables do you any good here? 'echo %userdomain%' will return the domain name if it's a domain member, or the local computer name if it's in a workgroup. - Laura -----Original Message----- From: Brian Desmond [mailto:[EMAIL PROTECTED] Sent: Sat 6/18/2005 3:34 PM To: [email protected] Cc: Subject: [ActiveDir] Batch Script Fun Ok, her's what I need to do from within a .cmd file (this is the only hook I have into a process that runs on every workstation once an hour - no I can't use a vbscript or any of that): Check device's domain If Domain <> MyDomain Run netdom and remove Reboot Otherwise Quit Now I figured out a way to use wmic to get the domain, but it returns multiple lines of text, and I don't have a clue how I would parse that in a batch file. The output of "wmic computersystem get domain" looks like this: Z:\Files\PsTools>wmic computersystem get domain Domain WORKGROUP Z:\Files\PsTools> I just need that "WORKGROUP". Ideally my script needs to work on NT and newer. I'll settle for 2000 & newer and the field guys can do the NT ones by hand if need be. The NT inventory purportedly has WMI installed, which I presume means wmic would work. I'm all up for a different way of doing this - I don't know of an environment variable or similar holding the machine's domain. Anyone got a way I can make this work? --brian List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/ List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
