Hmmm….  Let me think…..

YES!  ;o)

Rick


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dean Wells
Sent: Sunday, June 19, 2005 12:57 PM
To: Send - AD mailing list
Subject: RE: [ActiveDir] FW: Batch Script Fun

 

I appreciate the compliment Rick ... nothing interesting this time I'm afraid ...

 

Anybody interested in a script that resets every DC's DSRM password to the same value?  ;-)

--
Dean Wells
MSEtechnology
* Email: [EMAIL PROTECTED]
http://msetechnology.com

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rick Kingslan
Sent: Sunday, June 19, 2005 1:23 PM
To: [email protected]
Subject: RE: [ActiveDir] FW: Batch Script Fun

Heh….  I see that Dean has already answered this, so I’m most interested to see what the “Wizard of the Shell Script” has come up with….

 

Rick


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Desmond
Sent: Saturday, June 18, 2005 6:00 PM
To: [email protected]
Subject: [ActiveDir] FW: Batch Script Fun

 

Maybe this didn’t go through this morning?

 

 


From: Brian Desmond [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 18, 2005 2:34 PM
To: '[email protected]'
Subject: 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

 

Reply via email to