The timer reminds you about the event by playing your favorite music and showing a notification message. You can fully concentrate on the task at hand while waiting for a future task to be ready for action. If you have any questions, send email to me at or post your questions on the Official Scripting Guys Forum. The countdown timer tracks the amount of time till the specified event. I invite you to follow me on Twitter and Facebook. That is all there is to displaying a progress indicator. $colItems = Get-WmiObject -Query $wmiQueryįor($i = 1 $i -le $unt $i )Īs you can tell, the FilesProgressDemo.ps1 script is nearly identical to the earlier script-the difference is collecting the files instead of services. $wmiQuery = “Select name from win32_service where state = ‘running'” The ProgressDemoWMI.ps1 script is shown here. Armed with the count property, I can display a progress bar that indicates a percentage of completion of the command. One thing that is cool about WMI queries is that the result from Get-WmiObject is a collection. Using the Write-Progress Windows PowerShell cmdlet, I can trim the previous VBScript from 14 lines to six lines of code. Set colItems = objWMIService.ExecQuery(wmiQuery) Set objWMIService = GetObject(“winmgmts:\\”
0 Comments
Leave a Reply. |