Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 1. set master DB as the context database
- 2. Give the target template path (use only template specific subpath)
- 3. Parent folder path
- 4. ($_.TemplateName -eq "Image") - name of the existing template in quotes.
- */
- $master = [Sitecore.Configuration.Factory]::GetDatabase("master");
- $entryTemplate = $master.Templates['System/Media/Unversioned/Image'];
- cd master:"\media library\Documents";
- Get-ChildItem -recurse | ForEach-Object { if ($_.TemplateName -eq "Image") { $_.ChangeTemplate($entryTemplate) } };
- ///The following code changes the template of 'Versioned' Pdf files to 'Unversioned' Pdf files.
- //$master = [Sitecore.Configuration.Factory]::GetDatabase("master");
- //$entryTemplate = $master.Templates['System/Media/Unversioned/Pdf'];
- //cd master:"\media library\Documents";
- //Get-ChildItem -recurse | ForEach-Object { if ($_.TemplateName -eq "Pdf") { $_.ChangeTemplate($entryTemplate) } };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement