如何获得远程计算机操作系统版本在.NET中,没有WMI? [英] How to get remote machine OS version in .Net, without WMI?

查看:156
本文介绍了如何获得远程计算机操作系统版本在.NET中,没有WMI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让在.net(C#)远程计算机的操作系统版本? 使用WMI是不能接受我。

Is there any way to get OS version of remote machine in .Net(C#)? Using of WMI is not acceptable for me.

我有远程计算机的IP地址:)和管理员凭据

I have IP address of remote machine :) and administrator credentials

推荐答案

根据一些usings sgmoore答案

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"));
        }
    }

这篇关于如何获得远程计算机操作系统版本在.NET中,没有WMI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆