I am not familiar with Orchestrator but I suggest you save your output as a
formatted string rather than an object with multiple properties. This will
require a loop if your collections have more than one rule defined.
$Names = ((Get-CMDeviceCollection -CollectionId
SMS110101).CollectionRules).RuleName
Foreach($Name in $Names)
{
$Results += $Name + "`n"
}
$Results
From: [email protected] [mailto:[email protected]] On
Behalf Of Krueger, Jeff
Sent: Wednesday, January 14, 2015 8:49 AM
To: [email protected]
Subject: [powershell] Getting data out of a child powershell session for use
with Orchestrator
Hello, I'm hoping someone may have a good suggestion on how to pass data from a
child powershell process to the parent process in a fashion that Orchestrator
can publish on its databus. So I have the below script, where I have to call a
child powershell session because the activity that run the script natively only
opens a powershell 2.0 session, so for the cmdlets I want to use we have to
call a child session that will open in PS version 4. The problem I seem to be
running into is that the new object is a hash table and it appears if there is
more than one value the Orchestrator databus doesn't like it. Perhaps there is
a better way
$VAR = PowerShell {
CD HFH:
$DirRules = Get-CMDeviceCollection -CollectionId 'SMS110101'
$Names = $DirRules.CollectionRules | Select RuleName
New-Object pscustomobject -Property @{
Rules = $Names
}
}
$Results = $VAR.Rules
$Results
________________________________
CONFIDENTIALITY NOTICE: This email contains information from the sender that
may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected
from disclosure. This email is intended for use only by the person or entity to
whom it is addressed. If you are not the intended recipient, any use,
disclosure, copying, distribution, printing, or any action taken in reliance on
the contents of this email, is strictly prohibited. If you received this email
in error, please contact the sending party by reply email, delete the email
from your computer system and shred any paper copies.
Note to Patients: There are a number of risks you should consider before using
e-mail to communicate with us. See our Privacy & Security page on
www.henryford.com<http://www.henryford.com> for more detailed information as
well as information concerning MyChart, our new patient portal. If you do not
believe that our policy gives you the privacy and security protection you need,
do not send e-mail or Internet communications to us.
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be
used for urgent or sensitive issues
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1