Im just getting started with Powershell and im starting to get the hang of it. Im currently working on a script where i would like to run different things in parallel. For example i would like to capture some performance statistics in the background while some other things are running. So i found this great cmdlet called Start-Job that would do exactly what i want to do. So i created a small script with a Get-Counter to gather performance data. The command run fine on its own. But when i try to run it as a Job i get a popup with a "How do you want to open this file". If i choose notepad, i get nothing it it and the job runs without any data.
It looks like it happends everytime i try to run Get-Counter insdie the scriptblock statement. Other things work for some reason. Any help would be appritiated.
Example. This Works:
start-job -ScriptBlock {Get-ChildItem} This does not work
start-job -ScriptBlock {Get-Counter} Im guessing there are some kind of permissions i need or or is there something about Start-Job that i dont understand?
Start-Job -ScriptBlock {Get-counter '\Process(*)\% Processor Time'}