I have IP Address and Server name of a remote computer. I am able to query WMI
to get the OS version
if the computer is running Windows but is there a way i can query the remote computer and get the OS version
if the computer is not running Windows ( Linux
, Solaris
)?
I guess Active Directory
is going to give me what i need. This is what i have so far. Looks promising.
using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain))
{
ComputerPrincipal computer = ComputerPrincipal.FindByIdentity(ctx, "mylinuxservername");
if (computer != null)
{
var unObject = computer.GetUnderlyingObject() as System.DirectoryServices.DirectoryEntry;
if(null != unObject)
{
var osProperty = unObject.Properties.Cast<System.DirectoryServices.PropertyValueCollection>().Where(p => p.PropertyName == "operatingSystem");
if(null != osProperty.FirstOrDefault())
{
Console.WriteLine(osProperty.FirstOrDefault().Value);
}
}
}
}
There are many ways to detect that the remote computer is using Windows OS or Linux . Information gathering consist that part under penetration testing . Basically after scanning number of ports on the remote computer and the running services on these ports , we can decide that what OS is installed on the remote computer. There are one more way to check it , you can use SNMP Protocol for that purpose.
user@host $ snmpget -v2c -c <community string> <computer> <mib / oid >
eq.
user@host $ snmpget -v2c -c public x.x.x.x sysDescr.0
will gives you the information related to the remote computer . By default <community string> is public .
从Windows PC知道远程PC的Windows版本是什么,可以运行Windows命令“ systeminfo / s [PCname]”,也可以使用
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.