App-V : Remove all OS-nodes from all OSD files

If you want to remove the nodes from all of the OSD files at the content share at once, you only have to run this PowerShell Script.

$ContentPath = "D:\Content"
$dir = Get-ChildItem $Contentpath -recurse -include *.osd

foreach($osdfile in $dir)
{
    [xml] $xmldoc = New-Object XML
       $xmlDoc.Load($osdfile)
    $nodes = $xmlDoc.SelectNodes("/SOFTPKG/IMPLEMENTATION/OS")
    $root = $xmlDoc.SOFTPKG.Implementation

    foreach ($node in $root.OS)
    {
        [void]$root.RemoveChild($node)
    } 

    $xmldoc.save($osdfile)

Related posts:

  1. HOW-TO : Build a Host cluster with Hyper-V Beta 1

About Helmer

Helmer currently works as a Technical Consultant at Inter Access in Hilversum, the Netherlands. His areas of expertise are : Windows Client, Microsoft Deployment (WDS, MDT & SCCM) and Forefront Security. Besides his own blog he also blogs at the Dutch Microsoft IT Pro Community blog. He is also very interested in all sorts of new IT-related gadgets.