Hi Guys
We're trying to implement software metering in our organization.
It's set up in SCCM, with collections created for computers that meet the critera (eg. MS Visio not used in 180 days)
I need to write a runbook that gets the members of that collection, grabs the user associated to it, and then logs a service request to allow us to integrate some review activities and what not before the software is uninstalled.
My problem is getting orchestrator to see the user attached to the device in SCCM. I can do it remotely via powershell, but i cant find any way to return that data to orchestrator.
i've tried a few things without success, but the gist of the script is like this:
$Session=New-PSSession -ComputerName "(servername)"
$Result = Invoke-Command -Session $session -ScriptBlock {
Import-Module 'D:\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
$PSD = Get-PSDrive -PSProvider CMSite
CD "$($PSD):"
get-cmuserdeviceaffinity -devicename (devicename) | format-wide UniqueUserName
}
$result
Remove-PSSession $Session
the idea being to publish the $result variable to the runbook workflow. However it does not return anything, i suspect because it's running a number of commands to get there. If i remove 'invoke-command' from the equation and type all that manually into a remote pssession, it gives me the data i need (but only in the remote session of course). The most i've been able to manage is if i output the results to a text file instead of trying to store it in a variable, that works - but that's a bit messy and i think if the collection returned a lot of computers, that would get painful fast.
any ideas?