Jump to content


duckman8u2

Automate Task Sequence Export to ISO w/ PowerShell

Recommended Posts

Hey folks. Need some help here. So far, I have been able to figure out how to export an ISO file from a task sequence using powershell and it works great.

 

My issue is, the scheduled task that I have setup says that it has run successfully, however, I look in the folder (S:\SourceFiles\Applications\PowerShell\Export-ISOs\) and there is no ISO there.

I have created a task sequence to start a program to run whether a user is logged on or not and run with the highest privileges. For the Action on the task sequence, I have it start a program (powershell.exe) with the added arguments of "/executionpolicy bypass -file 'S:\SourceFiles\Applications\PowerShell\Export-ISOs\ExportISO-Server2012R2STD.ps1'".

 

The following is the powershell that exports an ISO file from the task sequence.

#Set connection to SCCM Server
Import-Module 'D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
CD SED:
#Create ISO
New-CMTaskSequenceMedia -StandaloneMedia -MediaInputType CdDvd -MediaSize SizeUnlimited -MediaPath "\\ew2ginw5947\SourceFiles\Images\ISO-Files\2012R2\Server2012R2-STD.iso" -ProtectPassword 0 -TaskSequenceId SED00034 -TaskSequenceDistributionPointServerName "ew2ginw5947.soloeng.prv"
Thanks in advance for any help.
Rob
!!UPDATE!!
On the way home I continued to ponder as to why the PS script would work when I ran it with my cred's and not the cred's I specified on the scheduled task. Hmmm! Cred's...
Yes, that's right, I specified cred's that the SCCM server did not know.
Needless to say, I updated the SCCM console and server with the correct cred's for the scheduled task sequence and what do you know... It works.
Edited by duckman8u2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.