批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程
[批处理文件精品]批处理版照片整理器[批处理文件精品]纯批处理备份&还原驱动在线第三方下载
返回列表 发帖

[转载代码] [PowerShell每日技巧]通过注册表查看时间服务器(20140326)

Maybe you'd like to get a list of timeservers registered in the Registry database. Then you probably run code like this:
  1. Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers'
复制代码
  1. $path = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers'
  2. $key = Get-Item -Path $path
  3. Foreach ($valuename in $key.GetValueNames())
  4. {
  5.   if ($valuename -ne '')
  6.   {
  7.     $key.GetValue($valuename)
  8.   }
  9. }
复制代码
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

返回列表