Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

remote session and displaying output ??

$
0
0

I have discovered that you can't use Out-Gridview within a remote session nor can you write to a file share.   I have the code below, the Out-File gets an access denied.  But if I try the same command without invoke-command it works fine.  And if I replace the Out-File with Out-Gridview I get an error.

 

$pc=Read-Host"Enter machine name"
Invoke-Command-ComputerName$pc-ScriptBlock {
$software=Read-Host"Enter software to search for"
$targetPC=$env:computername
$drop="\\MGApp-01\psscripts\logs"
Get-ChildItem-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName-like"*$software*" } | Select-Object DisplayName, DisplayVersion, UninstallString | out-file"$drop\$targetPC.txt"
}

I want to display my results from the remote computer, how do I do that?   

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles