How to get windows version from command line of remote server ?
For one server:
D:\> reg query "\\172.69.0.79\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
ProductName REG_SZ Windows Server 2008 R2 Enterprise
Note: Login to your client PC as domain user with local administrator privilege.
For multiple servers: (content republished, Source here)
Save the below code as a batch file:
REM Check OS Version on a remote server
@echo Off
pushd %~dp0
for /f %%a in (serverlist.txt) do (
Echo %%a is checked
reg query "\\%%a\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName
) >> OS_version_query_result.txt
In the same folder location of batch file, place the serverlist.txt file.
Just type one host name per line without any trailing space.
serverlist.txt read as below:
phygrsrv01
phyaprsrv01
172.36.88.101
10.1.0.122
Now execute the batch file, it creates a output file in the same location.
D:\> reg query "\\172.69.0.79\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
ProductName REG_SZ Windows Server 2008 R2 Enterprise
Note: Login to your client PC as domain user with local administrator privilege.
For multiple servers: (content republished, Source here)
Save the below code as a batch file:
REM Check OS Version on a remote server
@echo Off
pushd %~dp0
for /f %%a in (serverlist.txt) do (
Echo %%a is checked
reg query "\\%%a\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName
) >> OS_version_query_result.txt
In the same folder location of batch file, place the serverlist.txt file.
Just type one host name per line without any trailing space.
serverlist.txt read as below:
phygrsrv01
phyaprsrv01
172.36.88.101
10.1.0.122
Now execute the batch file, it creates a output file in the same location.
No comments:
Post a Comment