The output is probably not caused by an assignment operation (voidable statement), but on this line:
[System.Xml.XmlDocument] $Config;
In PowerShell, as a rule, all statements return a value (except voidable statements). I think the first time you run the script no output, it will be written to the console. However, on subsequent launches, $Config
will still contain the value of the previous run, and its value will be written to the screen.
- for the Out-Null cmdlet:
[System.Xml.XmlDocument] $Config | Out-Null
[System.Xml.XmlDocument] $Config | Out-Null
- void casting:
[void][System.Xml.XmlDocument]$Config
- assignment $ null:
$null = $Config
- or just don't declare the
$Config
variable
- ways to suppress this behavior.
jon Z
source share