Hi
I'm calling invoke-command and need to get the "return value". I've tried to simplify it below but basically the invoke-command will return the status of a database. This piece of the script works. But I need to call this from outside the invoke-command and return the status back outside
Invoke-Command -ComputerName XXXX -ScriptBlock {
# There is a code here which ends up returning the database status ...
$DatabaseStatus = "Online" }
How do I return the value of $DatabaseStatus from the invoke-command so that I can continue processing it?
I was hoping that I could $DBState = Invoke-Command ..... but it doesn't work - I realise that invoke-command is running on a remote machine and I don't know if you can pass output values of invoke-command back to the originating code?
Thanks in advance
Graham
Regards Graham New System Center 2012 Blog! -
http://www.systemcentersolutions.co.uk
View OpsMgr tips and tricks at
http://systemcentersolutions.wordpress.com/