标题: [转载代码] [PowerShell每日技巧]通过注册表查看时间服务器(20140326) [打印本页]
作者: DAIC 时间: 2014-4-4 20:35 标题: [PowerShell每日技巧]通过注册表查看时间服务器(20140326)
Maybe you'd like to get a list of timeservers registered in the Registry database. Then you probably run code like this:- Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers'
复制代码
- $path = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers'
-
- $key = Get-Item -Path $path
- Foreach ($valuename in $key.GetValueNames())
- {
- if ($valuename -ne '')
- {
- $key.GetValue($valuename)
- }
- }
复制代码
This code accesses the Registry key, and then uses its methods to get the value names, then dumps the values.
http://powershell.com/cs/blogs/tips/archive/2014/03/26/finding-time-servers-and-reading-all-regkey-values.aspx
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |