خرید بک لینک

I am trying to run a restart script against a list of computers, where it uses WMIC to see if users are logged in: WMIC /NODE: "workstation_name" COMPUTERSYSTEM GET USERNAME and then use psshutdown if no one is logged in. What I have found, is if the computer has multiple IP addresses, it will often coect to one of a different subnet, and retu ERROR: Description = The RPC server is unavailable. causing the script to think no one is logged in, and restart the system. Here is a problem computer:

C:>nslookup HOSTNAME
Server:  DHCP_SERVER
Address:  10.0.0.10
Name:    HOSTNAME.NET.LOCAL
Addresses:  100.1.1.30
          192.168.1.45
          172.1.1.6


C:>ping HOSTNAME

Pinging HOSTNAME.NET.LOCAL [172.1.1.6] with 32 bytes of data:
Request timed out.
Request timed out.

So my best guess is that WMIC is picking one of the 2 other IPs from DNS and trying to coect using those, where as psshutdown uses NETBIOS or another service to issue the shutdown and is happy with that.

So my question is, is there a way to use WMIC to either force it to use a specific subnet, or to force it to lookup IPs before executing the commands? It is a lot easier to use hostnames, as they can simply be exported from AD or similar, and I would really prefer to not have to convert everything over to using IPs.

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 16 ارديبهشت 1395 ساعت: 8:57

صفحه بندی