Problem: At some point Kaviza or VDI in a Box did not remove deactivated computers from AD either due to an improper shutdown, timing issue,… finding out which are in use and are not can take some time. Here is how I sped up the cleanup process.
Solution: Follow the steps below to export your computer names to bat log file. Then edit the bat file to ping the systems and export to a log file then review the results and clean up ad.
All of my Kaviza systems have the same prefix of FBWKVFB-x so I ran the following command to pull the list from AD and export to a bat file:
Dsquery computer domainroot –name FBWKVFB-* > c:\kavizapc.bat
then edit the bat file and use the find and replace command to replace the excess fields. Here is an example of the unedited output:
Note: the “-4” command is to use IPV4 ping only if you want to ping IPV6 only use –6 instead
On the first line remove the first “>” so it will look similar to this:
Ping FBWKVFB-7C246DT> c:\Kavizaping.txt
Ping FBWKVFB-114URFF>> c:\Kavizaping.txt
You can now run the Kavizapc.bat and view the output in C:\Kavizaping.txt:
Ping request could not find host FBWKVFB-7C246DT. Please check the name and try again.
Ping request could not find host FBWKVFB-114URFF. Please check the name and try again.
Any of the desktops that failed to ping are likely your excess systems that need removed.
Note: Just because they pinged does not mean they are still valid as your DNS records may not be up to date. If in doubt use the ping logs to do a reverse query for example here is a positive result:
Pinging FBWKVFB-MJJLD4K [192.168.100.100] with 32 bytes of data:
Reply from 192.168.100.100: bytes=32 time=3ms TTL=128
To confirm that IP really is FBWKVFB-MJJLD4K you can run the following command:
Ping –a 192.168.100.100
The first line of the results should show you the same PC name:
pinging FBWKVFB-MJJLD4K.ad.domain [192.168.100.100] ….