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'
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.
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.