Restart-Computer enhanced in powershell V3
来源:互联网 发布:网络银行的注册号码 编辑:程序博客网 时间:2024/05/17 03:40
In PowerShell v3, Restart-Computer now has a number of useful newparameters. For example, you can restart a remote machine and wait for thereboot process to finish.
-Wait: Halts the script until the machine has rebooted
-Timeout: Seconds to wait for the machine to restart
-For: Considers the computer to have restarted when the specified resourcesare available. Valid values: WMI, WinRM, and PowerShell.
-Delay: Interval in seconds used to query the remote computer to determineits availability specified by -For.
Before the PSv3 introduce, We have to use test-connection to make sure the IP connection already established , use get-service to make sure some service already running like WinRM.
The old code like:
# Test connectionTest-Connection -ComputerName $hst.ComputerName -Quiet
# Check the WinRM services status.Get-Service -ComputerName $hst.ComputerName -Name WinRM -ErrorAction SilentlyContinue | Where-Object{$_.Status -eq "Running"}
The new code like:
Restart-Computer -ComputerName $hst.ComputerName -For WinRM
- Restart-Computer enhanced in powershell V3
- Restart-Computer cmdlet enchancements in Windows PowerShell
- Powershell 1.1 computer configuration
- Enhanced JMS Scheduler in ActiveMQ
- Graceful Restart in Golang
- Powershell commands 之 Add-Computer
- PowerShell Get-Eventlog Remote Computer
- Powershell: schedule job in Powershell
- (codes)a program that could be used to restart computer
- MacOS出现 You need to restart your computer....错误
- SQLServer2008SP1安装报Restart computer failed的解决办法
- SQLServer2008安装报Restart computer failed的解决办法
- SQLServer2008SP1安装报Restart computer failed的解决办法
- Expression Web 3 & Blend 3 安装报错“Your computer is scheduled to restart. Restart your computer and run
- Automating Website Creation with PowerShell v3
- Windows Powershell in Action
- Type in PowerShell
- Invoke-Command in PowerShell
- MAC下Android的Eclipse开发环境的搭建
- FPGA与MCU/模拟技术整合提速
- UVa 442 - Matrix Chain Multiplication
- SettingsProvider的藏身之处
- 深入浅出Linux设备驱动之阻塞与非阻塞
- Restart-Computer enhanced in powershell V3
- [转]日本开设婚恋课 追女孩能赚学分
- 如何删除正在使用中的数据库
- Ogre学习笔记(一)xp系统 +VS2010+Ogre SDK 安装与首次编译
- Android Eclipse 源码工程 调试
- 为用户的成功操作提供正面反馈
- 开放-封闭原则(OCP)
- 随机概率发生器
- 开发wince下的usb音频设备驱动总结