Computing.Net > Forums > Programming > Logging netdom errors

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Logging netdom errors

Reply to Message Icon

Name: theredswan
Date: October 23, 2009 at 13:14:42 Pacific
OS: Windows XP
Subcategory: Batch
Tags: netdom, batch, rename, Computer, error
Comment:

I'm pulling computer names from a text file, changing the names to a new name, and trying to log any errors in a separate text file, using a batch command. However, I don't know how to run an if statment that tests the netdom command. Here is the relevant code:

FOR /F "skip=2 tokens=1,2" %%1 IN (rendompc.txt) DO (
netdom renamecomputer %%1 /newname:%%2 /userD:secondary.frontier\administrator /passwordD:Password
/userO:secondary.frontier\administrator /passwordO:Password /verbose>test.txt /force /reboot:30
if errorlevel 1 echo %%1 %%2 FAIL >>computernamechange.txt
)

How can I log that error or test for fail?



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: October 23, 2009 at 14:44:10 Pacific
Reply:

if errorlevel 1 echo %%1 %%2 FAIL >>computernamechange.txt
If this doesn't work, you'll probably have to parse STDERR in some fashion.


0
Reply to Message Icon

Related Posts

See More


DOS 'For' Command More than 31 columns


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Logging netdom errors

Child alive & parent dead www.computing.net/answers/programming/child-alive-amp-parent-dead/7161.html

Array/Dictionary/Something else www.computing.net/answers/programming/arraydictionarysomething-else/15451.html

Reading Windows Variables www.computing.net/answers/programming/reading-windows-variables/7734.html