Windows PowerShell的12项酷功能

开发者在线 Builder.com.cn 更新时间:2008-07-09作者:CnBeta 来源:enet

本文关键词: PowerShell Windows 2003 Windows Server Windows

    8. PowerShell 用作日历计算

  计算多少天到新年:

  PS> ([DateTime]"1/1/2007" -[datetime]::now).days

 

    9. 返回机器上某种类型文件的数量

  Windows Vista有许多类型的事件记录和组策略文件等.下列命令是返回当前目录及其子目录中VBScript, Bat 和 PowerShell 脚本的数量:

  PS> dir -include *.vbs, *.ps1, *.bat -recurse   group-object extension -noelement

  10. 从命令行收集Windows System Assessment Tool数据

  PS> get-wmiobject win32_winsat   format-table __SERVER, *SCORE -autosize

    PS> get-wmiobject win32_winsat   select *score   out-chart -Title "System Assessment Scores by PowerGadgets"

  11. 配置UAC(User Account Control)

  PS> set-itemproperty -path HKLM:SOFTWAREMICROSOFTWINDOWSCurrentVersionPoliciesSystem -name ConsentPromptBehaviorAdmin -value 0

  12. 管理BitLocker

  PS > $drives = get-wmiobject -namespace rootCIMv2SecurityMicrosoftVolumeEncryption -class Win32_EncryptableVolume

  PS> $drives   format-table DriveLetter, PersistentVolumeID -autosize

  PS> $BitLockDrive = $drives[0]

  PS> $BitLockDrive.GetProtectionStatus()

  PS> $BitLockDrive.DisableKeyProtectors()

  PS> $BitLockDrive.EnableKeyProtectors()

 

用户评论

  • 用户名
  • 评论内容