Usage:

PreMigMachChk /M (HostName | IP_Address) [/C Current_DOMAIN] [/T Target_DOMAIN]
                           [/F nnn] [/D] [/I] [/W] [/A] [/P] [/R] [/V | /Q]

Use PreMigMachChk to help verify that a remote host is ready for AD migration,
or to verify general availability/access of a remote host. Exits with error
code 0 if successful. Host and domain names should be NetBIOS names.

/M (required): Specify the host to check
/C (optional): Specify the expected CURRENT domain of the host
/T (optional): Specify the TARGET domain we are migrating to
/D (optional): Disable check for free space (15MB default) on admin$ share
/F (optional): Specify free space (MBs) needed on admin$ share (15MB default)
/I (optional): Ignore NetBIOS name mismatch
/W (optional): Workstation Only: Exclude (fail) hosts that are servers
/A (optional): Allow NT4: Include (pass) hosts running NT4 OS
/P (optional): Ping host to verify online
/R (optional): Try connecting with DNS name or IP Address if NetBIOS name fails
/V (optional): Verbose: Shows additional information (leading ! in output)
/Q (optional): Quiet: Set errorlevel but display nothing (except syntax errors)


Note that in the examples below 'C:\Utils>' is my prompt at the command line. You don't type this in. :-)  and yes someone asked.

Example #1  - Silently check (ping first as /p used)  that we can access a PC named TheKillers. We don't care about the anount of disk space free (so the /D switch is used):

C:\Utils> PreMigMachChk /m TheKillers /d /p /q
C:\Utils> echo.%errorlevel%
0

Example #2  - Check that we can access a PC named PapaRoach. Ping host (/p) and output more verbose info (/v) :

C:\Utils> PreMigMachChk /m PapaRoach /p /v
 + Resolved hostname to: 192.168.1.69
 + Host UP. Successfully pinged: 192.168.1.69
 + NetBIOS name matches.
 + PC in domain: Metal
 ! OS version: 5.1
 ! OS comment: BB Dev PC
 ! Active sessions: 2
 + Admin$ share exists and has greater than 15MB free.
 + Connected to remote registry.
 + WORKSTATION role.
 + W2K or greater OS.

C:\Utils> echo.%errorlevel%
0

Example #3  - Like  Example #2, but we are expecting the PC to currently be in the 'BlueGrass' domain, and plan to move it to the 'Metal' domain:

PreMigMachChk /m PapaRoach /p /c BlueGrass /t Metal
 + Resolved hostname to: 192.168.1.69
 + Host UP. Successfully pinged: 192.168.1.69
 - PC is already in the METAL domain.
 
C:\Utils> echo.%errorlevel%
8

Example #4 (4NT/TCMD) - Make a user-defined variable functions for JP Software's 4NT or Take Command. We are creating one function that pings the host first and another that doesn't. We use back-quotes to keep %1 from being expanded during creation of the function as we are creating them on the command line here. If you are placing this in a text file to be read by a FUNCTION /R call, you won't need the back-quotes. An example FOR loop using the PMMCp function follows:

C:\Utils> function PMMC=`%@exec[C:\Utils\PreMigMachChk.exe /m %1 /q  /r /d]`
C:\Utils> function PMMCp=`%@exec[C:\Utils\PreMigMachChk.exe /m %1 /p /q  /r /d]`

:: Here we read hostnames off the clipboard and loop through them to verify they are up and accessible
C:\Utils> for /f %a in (@CLIP:) do (@Echos.%a, %+ Iff %@PMMCp[%a] EQ 0 Then %+ @Echo.Yes %+ Else %+ @Echo.No %+ EndIff)

server1,Yes
server2,No
server3,Yes
 

Copyright © 2004-2007 Gerald's Tools