Geez. "The only two things I have to suggest..." From: [email protected] [mailto:[email protected]] On Behalf Of Michael B. Smith Sent: Friday, April 17, 2015 1:35 PM To: [email protected] Subject: [powershell] RE: Help with calling powershell from powershell
The only two things I have two suggest are to check the credentials you are running the Activity under and to ensure that the SCCM module is loaded. From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Krueger, Jeff Sent: Friday, April 17, 2015 1:28 PM To: [email protected]<mailto:[email protected]> Subject: [powershell] RE: Help with calling powershell from powershell Bump, anyone? From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Krueger, Jeff Sent: Thursday, April 16, 2015 2:27 PM To: [email protected]<mailto:[email protected]> Subject: [powershell] Help with calling powershell from powershell Working on creating a run book with Orchestrator and using the .Net Activity to run a PowerShell script only calls a PowerShell 2.0 session so if you need to use newer cmdlets you have a call a session in your session. We've done this before with no issues, until the script I'm working on now, which just runs without terminating and since it's not in the parent session I can't see any errors. If I test the script without running it in a new session it works just fine, running it under session in that session though it doesn't work. Below is the script: $VAR = PowerShell { cd SMS: $DestMachine = 'some computer name' $DestResourceID = (Get-CMDevice -Name $DestMachine).ResourceID $CollNames = @() $Colls = ('SMS00727', 'SMS00780') #Create the direct Rule for the destination PC in each collection Foreach ($Coll in $Colls) { #Add-CMDeviceCollectionDirectMembershipRule -CollectionId $Coll -ResourceId $DestResourceID $Collection = (Get-CMDeviceCollection -CollectionID $Coll).Name $CollNames += $Collection } cd c: $CollNames | Out-File -FilePath "c:\Workflow\Clone_Collection_Membership\$DestMachine.txt" } Jeff Krueger [email protected]<mailto:[email protected]> IT - Henry Ford Health System 248.853.4466 ________________________________ 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<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.myitforum.com_forums_default.asp-3FcatApp-3D1&d=AwQFAg&c=aLnS6P8Ng0zSNhCF04OWImQ_He2L69sNWG3PbxeyieE&r=pQGVi_ygWZb0EWR_EeMFzgKJCQ8AFTQI7Ck6iiIPItI&m=aaZBdPYqoZa84ta7ekSpZ21DhPYuvUxSpD-rPZ8Wrhw&s=IY4IyRa_cr8HiPxofosZfh-G5Wv3NVhy48xuq2bpmzs&e=> ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1
