如何检查Windows安装日期 [英] How to check windows installation date

查看:119
本文介绍了如何检查Windows安装日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用代码vb.net或c sharp检查Windows安装日期







i尝试过但错误计算机名称没有声明

那里有什么进口请引导它



我尝试了什么:



i使用注册表访问然后它可以从注册表获得hxsa号码



公共共享函数GetWindowsInstallationDateTime(computerName as String)as DateTime 
Dim key as Microsoft.Win32.RegistryKey
key = Microsoft.Win32。 RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine,computerName)
key = key.OpenSubKey(SOFTWAREMicrosoftWindows NTCurrentVersion,False)
如果键IsNot Nothing那么
Dim startDate as DateTime
Dim regVal as Int64

startDate = new DateTime(1970,1,1,0,0,0)
regVal = Convert.ToInt64(key.GetValue(InstallDate))。 ToString())

返回startDate.Add秒(regVal)
结束如果

返回DateTime.MinValue
结束函数

解决方案

< blockquote>像你之前的121个问题一样,这可以通过一个简单的谷歌来解决:如何检查windows安装日期c - Google搜索 [ ^ ] br />
按照几个链接进行操作:我可以使用C#获取Windows的原始安装日期吗? - 堆栈溢出 [ ^ ]使用OpenBaseKey而不是OpenRemoteBaseKey进行一个微不足道的更改,你就完成了。



请,尝试自己做至少基础研究而不是浪费你的时间,或者我们的。


how to check windows installation date

by using code vb.net or c sharp



i tried but it is getting error computer name not declare
what is import there please guide it

What I have tried:

i using a registry acess then it can get just hxsa number from registry

Public Shared Function GetWindowsInstallationDateTime(computerName as String) as DateTime
	Dim key as Microsoft.Win32.RegistryKey
	key = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, computerName)
	key = key.OpenSubKey("SOFTWAREMicrosoftWindows NTCurrentVersion", False)
	If key IsNot Nothing Then
		Dim startDate as DateTime
		Dim regVal as Int64
 
		startDate = new DateTime(1970, 1, 1, 0, 0, 0)
		regVal = Convert.ToInt64(key.GetValue("InstallDate").ToString())
 
		Return startDate.AddSeconds(regVal)
	End If
 
	Return DateTime.MinValue
End Function

解决方案

Like a lot of your previous 121 questions, this can be solved with a simple google: how to check windows installation date c - Google Search[^]
Follow a few links and you get to this: Can I get the Original Install Date of the Windows using C#? - Stack Overflow[^] A trivial change to use OpenBaseKey instead of OpenRemoteBaseKey and you're done.

Please, try to do at least basic research yourself and not waste your time, or ours.


这篇关于如何检查Windows安装日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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