Hello,
I have the following script whereby I want to list all the running (opened) applications on a remote computer. It's a shared computer between two people who use the same generic ID. Before one RDP's into it, I thought it would be interesting to see if any apps are opened before logging in.
Here is the code:
$cred = Get-Credential Invoke-Command -ComputerName server123 {Get-Process *mail* | Where {$_.MainWindowHandle} | Select Name,MainWindowTitle} -Cred $cred
It works in that it asks for my credentials and runs without any error...but this script also does not display any running applications. I'm not sure what it should show. Perhaps I need to add a line of code to display what it found?
Another bit of info I would like to use in this script is to also confirm that the generic ID is logged in at the time I run this script. I could use the following bit of code:
get-wmiobject Win32_ComputerSystem -computername server123 | format-table -property username
But when I run this code I get an access denied message. I'm assuming I need to use the Get-Credential again from my first script, but I'm unsure how to use it in the get-wmiobject?
Any help you can provide would be greatly appreciated.
Thank you.