用于 Windows XP 的 Windows PowerShell 1.0

时间: 2008-05-16 / 分类: 未分类 / 浏览次数: / 0个评论 发表评论

Anti反盗图片读取中...Powered By 54bb.com

Windows PowerShell 包括:

• 超过 130 个命令行工具(称为“commandlets”),用于执行常见系统管理任务,如管理服务、进程、事件日志、证书、注册表以及使用 Windows Management Instru mentation (WMI)。

• 采用标准命名约定和通用参数的命令行工具,易于掌握和使用;以及用于对数据和对象进行排序、筛选以及格式设置的简便工具。

• 对现有脚本语言、现有命令行工具以及多种 Windows 版本的支持,其中包括 Windows XP、Windows Server 2003、Windows Vista™ 以及 Windows Server(代码名称为“Longhorn”)。

• 方便的功能,使用户能够浏览数据存储(如注册表和证书存储),就像面对文件系统一样。

• 用于管理位于不同存储中以及采用不同格式的 Windows 数据的标准实用程序,这些数据包括 Active Directory Service Interfaces (ADSI)、Windows Management Instrumentation (WMI)、组件对象模型 (COM) 对象、ActiveX 数据对象 (ADO)、HTML 和 XML。

• 在命令行进行的高级表达式分析和 .NET Framework 对象处理,其中包括对对象进行流水线处理以帮助提高 IT 专业人员的工作效率。

• 可扩展的接口,使独立软件供应商和企业开发人员能够构建自定义 cmdlet 以满足特有的应用程序和系统管理要求。

微软windowsvistablog上,开发人员列举了Windows Vista中Windows PowerShell所提供的12项酷酷的功能:

1. 内置Cmdlets (即"commandlets")
Windows PowerShell中的所有Cmdlets都允许这样的动名词:get-service, get-process, stop-service, get-wmiobject.

2. 强大的通配符和操作对象
要得到以w开头的服务及其依赖服务只要输入:
PS> get-service w* | format-list DisplayName, DependentServices

3. 在犯错误前测试命令
Windows PowerShell 有意向独特的功能:Whatif ,可以不执行命令就告诉你命令执行结果.如:
PS> stop-service w3* -whatif

4. 获取副本
PowerShell 可以开始和结束所有命令的副本,可以在脚本中轻易测试命令并同时保存.
PS> Start-Transcript -Path c:demodfoshow.txt
PS> Stop-Transcript

5. 从命令行发布Windows对话
因为Windows PowerShell位对象而优化,可以向.NET Framework一样从命令行访问COM对象,下列命令告诉你的Vista机器发表"Windows Vista and PowerShell"字串.
PS> $spVoice = new-object -com "SAPI.spvoice"
PS> $spVoice.Speak("Windows Vista and PowerShell")

6. 使用Windows PowerShell访问诸如Windows Media Player 11等的应用程序
PS> $band = "The Posies"
PS> $player = New-object -com wmplayer.ocx
PS> $playlist = $player.mediacollection.getbyauthor($band)
PS> $player.openPlayer($playlist.item(0).sourceurl)

7. Windows PowerShell作为命令行存储计算器
PowerShell可以完成基本的计算工作
PS> 2*2

Windows PowerShell也可以快速解决存储问题,例如,备份11GB的数据需要多少个700MB的CD.
PS> 11gb/700mb

那么,需要多少个1000GB的存储来备份每个320GB,共425个的Vista桌面呢?
PS > (320gb*425)/1000GB

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()

系统要求:

支持的操作系统:Windows XP

需要 .NET Framework 2.0 版

您阅读此文共耗时

发表评论

你必须 登录后 才能留言!