Link to home
Start Free TrialLog in
Avatar of Ed1974
Ed1974Flag for United States of America

asked on

Pass SCCM Task Sequence Variables to PowerShell script

Greetings Experts,

I have a PowerShell script that sends an email when the imaging process is completed in MDT.  It also send a notification to my Slack channel.  It works really nice so I would like to incorporate the same script in an SCCM OSD deployment task sequence.  I thought that by simply adding $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment at the start of the script would make everything work.  I was wrong!

I am pre-populating all my variables before the script runs.  When I pause the TS I can see all my variables with the correct values.  My goal is to pass my custom (and some default) variables to the PowerShell script.  Any help I can get would be greatly appreciated.

See attached PowerShell script.
TSSendMail.ps1
ASKER CERTIFIED SOLUTION
Avatar of Mike Taylor
Mike Taylor
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial