Is there any way to get OS version of remote machine in .Net(C#)? Using of WMI is not acceptable for me.
I have IP address of remote machine :) and administrator credentials
based on sgmoore answer with some usings
public string GetOsVersion(string ipAddress)
{
using (var reg = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, ipAddress))
using (var key = reg.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\"))
{
return string.Format("Name:{0}, Version:{1}", key.GetValue("ProductName"), key.GetValue("CurrentVersion"));
}
}
If you have administrator credentials for the remote machine you could use PsExec to run a command remotely to get the OS version e.g.
CMD /c ver
You can write a wrapper to run PsExec in C# by using the Process class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With