如何获得系统初始安装时间、系统启动时间等信息
本帖最后由 qqgghh1 于 2009-9-23 16:40 编辑通过systeminfo 命令可以获得,AU3如何实现?
谢谢! WMI可以,API不知道。 dos回显也可以解决。。 本帖最后由 qqgghh1 于 2009-8-24 17:26 编辑
DOS回显是可以,不过显得有些幼稚啊,寻求AU3的WMI高手支援。万分感谢! 解决不了准备清贴了。继续寻求高手,谢谢! 系统安装日期读取注册表
系统启动日期AU3自带就能获取#Include <Date.au3>
$_Date = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate")
$_Date = _DateAdd( 's',$_Date, "1970/01/01 08:00:00")
$_TickCount=_Date_Time_GetTickCount()
dim $iDate,$iHours,$iMins,$iSecs
_TicksToTime($_TickCount, $iHours,$iMins,$iSecs)
MsgBox(0,"","系统安装时间 " & $_Date & @CRLF & "系统启动时间 " & $iHours & "时" & $iMins & "分" & $iSecs & "秒")
留个记号 这个暂时用不着 ddddddddddddddddddddddddddddddd $dtmConvertedDate = ObjCreate("WbemScripting.SWbemDateTime")
$strComputer = "."
$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
$colOperatingSystems = $objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For $objOperatingSystem in $colOperatingSystems
$dtmConvertedDate.Value = $objOperatingSystem.InstallDate
$dtmInstallDate = $dtmConvertedDate.GetVarDate
Msgbox (0,"系统信息","Boot Device: " & $objOperatingSystem.BootDevice &@CRLF _
& "Build Number: " & $objOperatingSystem.BuildNumber &@CRLF _
& "Build Type: " & $objOperatingSystem.BuildType &@CRLF _
& "Caption: " & $objOperatingSystem.Caption &@CRLF _
& "Code Set: " & $objOperatingSystem.CodeSet &@CRLF _
& "Country Code: " & $objOperatingSystem.CountryCode &@CRLF _
& "Debug: " & $objOperatingSystem.Debug &@CRLF _
& "Encryption Level: " & $objOperatingSystem.EncryptionLevel &@CRLF _
& "Install Date: " & $dtmInstallDate &@CRLF _
& "Licensed Users: " & $objOperatingSystem.NumberOfLicensedUsers &@CRLF _
& "Organization: " & $objOperatingSystem.Organization &@CRLF _
& "OS Language: " & $objOperatingSystem.OSLanguage &@CRLF _
& "OS Product Suite: " & $objOperatingSystem.OSProductSuite &@CRLF _
& "OS Type: " & $objOperatingSystem.OSType &@CRLF _
& "Primary: " & $objOperatingSystem.Primary &@CRLF _
& "Registered User: " & $objOperatingSystem.RegisteredUser &@CRLF _
& "Serial Number: " & $objOperatingSystem.SerialNumber &@CRLF _
& "Version: " & $objOperatingSystem.Version)
Next 在应用层面来看 没有什么幼稚不幼稚 dos回显比wmi更可靠不是所有的机器都开启了wmi服务 10# sxd
严重同意,一般情况下,wmi我都不开 系统安装日期读取注册表
系统启动日期AU3自带就能获取#Include
$_Date = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "InstallDate")
$_Date = _DateAdd( 's',$_Date, "1970/0 ...
bing614 发表于 2009-9-22 19:38 http://www.autoitx.com/images/common/back.gif
谢谢分享代码,很不错! 把这个命令加到AU3中 留个记号 哈哈 系统启动时间在哪个位置保存的哦?
页:
[1]
2