I have a script that is being deployed to Windows 7 clients with PowerShell 2.0 using ConfigMgr 2012 R2. In the script I need to expand a cab file and load a particular xml file. The script bombs out when it is loading the xml file. I’ve tried a few different ways of loading the xml:
[xml]$xml = Get-content $file
$xml = [xml](Get-content $file)
$xml = New-Object XML
$xml = New-Object -TypeName XML
To track the progress the progress of the script I started logging the progress. $xml is being set as System.Xml.Document instead of the content of the xml file. After it loads the xml and sets $xml it has a value like “Microsoft (R) File Expansion Utlity Version…Adding C:WindowsTEMP<filename> to Extraction Queue Expanding Files…”
Has anyone ran into this before? The weird thing is that the xml files load without any issues when ran directly from the package using PowerShell. It only happens when running the deployment from Software Center.