Board logo

标题: [转载代码] powershell 查看域的版本 [打印本页]

作者: xiaopingood    时间: 2012-12-24 17:17     标题: powershell 查看域的版本

  1. $a=[system.directoryservices.activedirectory.activedirectoryschema]::getcurrentschema()
  2. $b=$a.getdirectoryentry()
  3. switch($b.objectversion)
  4. {
  5. 13 {"{0,25}" -f "Schema Version 13 : Windows 2000";break}
  6. 30 {"{0,25}" -f "Schema Version 30 : Windows 2003";break}
  7. 31 {"{0,25}" -f "Schema Version 31 : Windows 2003 R2";break}
  8. 44 {"{0,25}" -f "Schema Version 44 : Windows 2008";break}
  9. 47 {"{0,25}" -f "Schema Version 47 : Windows 2008 R2";break}
  10. default {"{0,25} {1,2}" -f "Unknow Schema Version :",$($b.objectversion);break}
  11. }
复制代码
简单实用,很方便!




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2