Netdom command logging success or failure?

J

Jeff T

Hello- I tried the Windows Server Scripting group and haven't recived a
reply, I hope someone can help me here.

I'm trying to log success and failures when I mass join computers to
my domain.

The command below works but doesn't log the computer name.

for /f %%a in (stations.txt) do (
netdom join /d:FQDN %%a /uo:Local_Account /po:Local_Password
/ud:DA_Account /pd:DA_Password /reboot > join.log)


When I add %%a after /reboot and before > I receive the following
message in the output.log:

The parameter a was unexpected.
The parameter is incorrect.

for /f %%a in (stations.txt) do (
netdom join /d:FQDN %%a /uo:Local_Account /po:Local_Password
/ud:DA_Account /pd:DA_Password /reboot %%a > join.log)


How can I log if the command was successful or failded against the
system?

Thanks!
 
J

Jerold Schulman

call :logit>>join.log 2>>&1
....
....


:logit
for /f %%a in (stations.txt) do (
netdom join /d:FQDN %%a /uo:Local_Account /po:Local_Password/ud:DA_Account /pd:DA_Password /reboot
)
goto :EOF


Hello- I tried the Windows Server Scripting group and haven't recived a
reply, I hope someone can help me here.

I'm trying to log success and failures when I mass join computers to
my domain.

The command below works but doesn't log the computer name.

for /f %%a in (stations.txt) do (
netdom join /d:FQDN %%a /uo:Local_Account /po:Local_Password
/ud:DA_Account /pd:DA_Password /reboot > join.log)


When I add %%a after /reboot and before > I receive the following
message in the output.log:

The parameter a was unexpected.
The parameter is incorrect.

for /f %%a in (stations.txt) do (
netdom join /d:FQDN %%a /uo:Local_Account /po:Local_Password
/ud:DA_Account /pd:DA_Password /reboot %%a > join.log)


How can I log if the command was successful or failded against the
system?

Thanks!

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
J

Jeff T

Jerold,

The logit command works great, I get the whole command and success and
failures. Is their a way to parse out the command in the log and just
get the machine name and results.

Thanks!
 
J

Jerold Schulman

Jerold,

The logit command works great, I get the whole command and success and
failures. Is their a way to parse out the command in the log and just
get the machine name and results.

Thanks!

call :logit>>"%TEMP%\join.log" 2>>&1
set msg=
for /f "tokens=1-4*" %%a in ('type "%TEMP%\join.log"') do (
set work=%%e
call :netdom %%a %%b %%c %%d
)
@echo.%msg%>>join.log
endlocal
goto :EOF
:logit
for /f %%a in (stations.txt) do (
netdom join /d:FQDN %%a /uo:Local_Account /po:Local_Password/ud:DA_Account /pd:DA_Password /reboot
)
goto :EOF
:netdom
if /i "%1" EQU "netdom" goto doit
set msg=%msg% %1 %2 %3 %4 %work%
goto :EOF
:doit
@echo.%msg%>>join.log
set msg=%4
goto :EOF







Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top