- $scriptblock = {
- Write-Output " Step 1 : Completed"
- #do Some work
- Write-Output " Step 2 : Completed"
- #do Some work
- Write-Output " Step 3 : Completed"
- #do Some work
- }
- $out = Invoke-Command -ComputerName $computerName -Credential $cred
- $statusbar1.Text = $out #Write some working code so that it will update the status bar with each step
Update Statusbar for remote PS session
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- Abhishek_Paul
- Posts: 24
- Last visit: Fri Jun 15, 2018 2:04 am
Update Statusbar for remote PS session
Re: Update Statusbar for remote PS session
You can try this:
- Invoke-Command -ScriptBlock $sb -ComputerName $computerName -Credential $cred |
- ForEach-Object{
- $statusbar1.Text = $_
- [System.Windows.Forms.Application]::DoEvents()
- }
- Abhishek_Paul
- Posts: 24
- Last visit: Fri Jun 15, 2018 2:04 am
Re: Update Statusbar for remote PS session
I get nothing in statusbar .jvierra wrote:You can try this:
Invoke-Command -ScriptBlock $sb -ComputerName $computerName -Credential $cred | ForEach-Object{ $statusbar1.Text = $_ [System.Windows.Forms.Application]::DoEvents() }
I understand that we can get output from remote Ps-Session and save the result locally . With the same logic we can save the result to a variable and feed it ti statusbar1.text .
With the solution provided by you , we need to tweak something to get the result .I believe it's possible.
Re: Update Statusbar for remote PS session
This works perfectly for me:
- Attachments
-
- Test-WordHosting.psf
- (13.36 KiB) Downloaded 109 times
- Abhishek_Paul
- Posts: 24
- Last visit: Fri Jun 15, 2018 2:04 am
Re: Update Statusbar for remote PS session
I was doing a silly mistake.jvierra wrote:This works perfectly for me:
Thanks a billion Jvierra ... You are awesome as always.