|
Thanks! Works like a charm. From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dean Wells Copy and paste the following syntax into a
shell script, to execute directly from the command prompt simply reduce the double-percent
to a single percent in both cases. for /f "tokens=3" %%a in ('net
config workstation ^| find "Workstation domain"') do set
MYDOMAIN=%%a -- From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Desmond Maybe this didn’t go through this morning? From: Brian Desmond
[mailto:[EMAIL PROTECTED] 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 |
- RE: [ActiveDir] FW: Batch Script Fun Dean Wells
- RE: [ActiveDir] FW: Batch Script Fun Brian Desmond
- RE: [ActiveDir] FW: Batch Script Fun Robert Williams \(RRE\)
- RE: [ActiveDir] FW: Batch Script Fun Dean Wells
- RE: [ActiveDir] FW: Batch Script Fun Ruston, Neil
- RE: [ActiveDir] FW: Batch Script Fun Dean Wells
