You can add -ignoredependency on the import-cmtasksequence line, or don't 
export with dependency, or both.

From: listsadmin@lists.myitforum.com [mailto:listsadmin@lists.myitforum.com] On 
Behalf Of Marcum, John
Sent: Thursday, May 5, 2016 11:40 AM
To: 'powersh...@lists.myitforum.com' <powersh...@lists.myitforum.com>
Subject: [powershell] RE: Migrate MDT Task Sequences

It actually does work if I do a manual import and tell it to ignore dependency. 
Can the ignore dependency be set via the script?

Of course I'll need to repoint to the packages once I get the TS into the new 
site but that's simple compared to recreating everything.







From: listsadmin@lists.myitforum.com<mailto:listsadmin@lists.myitforum.com> 
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Russ Rimmerman
Sent: Thursday, May 5, 2016 11:15 AM
To: powersh...@lists.myitforum.com<mailto:powersh...@lists.myitforum.com>
Subject: [powershell] RE: Migrate MDT Task Sequences

Hmm, you'd have to export all the packages/apps referenced by the TS as well, 
and then massage the exports to reflect the new site code and package/app IDs 
since it would all still be referencing the source site code in the XMLs.  So, 
no - not with this simple export/import alone.

From: listsadmin@lists.myitforum.com<mailto:listsadmin@lists.myitforum.com> 
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Marcum, John
Sent: Thursday, May 5, 2016 10:39 AM
To: powersh...@lists.myitforum.com<mailto:powersh...@lists.myitforum.com>
Subject: [powershell] RE: Migrate MDT Task Sequences

Silly question... Will this still work when the site codes are different?

From: listsadmin@lists.myitforum.com<mailto:listsadmin@lists.myitforum.com> 
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Russ Rimmerman
Sent: Thursday, May 5, 2016 10:20 AM
To: powersh...@lists.myitforum.com<mailto:powersh...@lists.myitforum.com>
Subject: [powershell] RE: Migrate MDT Task Sequences

Oops the -WithContent should be $True not @True, but only if you need the 
content.
You could also use -WithDependence $True if you need the dependencies

From: Russ Rimmerman
Sent: Thursday, May 5, 2016 10:17 AM
To: 'powersh...@lists.myitforum.com' 
<powersh...@lists.myitforum.com<mailto:powersh...@lists.myitforum.com>>
Subject: RE: Migrate MDT Task Sequences

Here's a simple export each TS to an individual zip (you could add -withcontent 
and other switches if needed)

import-module C:\sccm\AdminConsole\bin\ConfigurationManager.psd1
CD PRI:
$ts = Get-CMTaskSequence
foreach ($item in $ts)
{
Export-CMTaskSequence -WithContent @True -TaskSequencepackageiD $item.PackageID 
-exportfilepath ("C:\temp\" + $item.PackageID + ".zip")
}

Here's a simple import of each .zip to a TS
import-module C:\sccm\AdminConsole\bin\ConfigurationManager.psd1
CD PRI:
$dir = Get-ChildItem "c:\temp\PRI*.zip"
foreach ($file in $dir)
{
Import-CMTaskSequence -ImportFilePath $file
}


From: listsadmin@lists.myitforum.com<mailto:listsadmin@lists.myitforum.com> 
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Marcum, John
Sent: Thursday, May 5, 2016 9:44 AM
To: 'powersh...@lists.myitforum.com' 
<powersh...@lists.myitforum.com<mailto:powersh...@lists.myitforum.com>>
Subject: [powershell] Migrate MDT Task Sequences

Is it possible to make this export-CMTaskSequence loop through all task 
sequences and export each of them to an individual zip file? If so how? And the 
next obvious question... How about automating the import too?






________________________________

Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.








Reply via email to