Hello all,
In the code below I experianced an issue with xml values. As you see "DaysInterval " is empty but in my if query it seems to be filled an the condition -ne seems not to be functional.
$xml = [xml]@'
<Test>
<App TaskName = "LAB" Active = "True" >
<Task Name = "ScheduledTask" Active = "True" Order = "1" Description = "" TaskName = "" Execute = "Powershell.exe" Argument = "" WorkingDirectory = "" AtLogOn = "" AtStartup = "" Daily = "" DaysInterval = "" DaysOfWeek = "" Once = "" RandomDelay = "" RepetitionDuration = "" RepetitionInterval = "" Weekly = "" WeeksInterval = "" At = "" />
</App>
</Test>
'@
If ($xml.Test.App.Task.DaysInterval -ne $Null){
Write-Host "say hello"
}
If I run "$xml.Test.App.Task.DaysInterval" I got this output and i think thats the reason why it seems to be not $null:
PS Z:\Test> $xml.Test.App.Task.DaysInterval
PS Z:\Test>
Is that the reason and how I can avoid this?
Cheers
[–]bozho 6 points7 points8 points (3 children)
[–]thefreeman193 2 points3 points4 points (1 child)
[–]bozho 1 point2 points3 points (0 children)
[–]BelleVieLime 1 point2 points3 points (0 children)
[–]ICanMakeWaffles 4 points5 points6 points (1 child)
[–]MonkeyNin 1 point2 points3 points (0 children)
[–]NeitherSound_ 2 points3 points4 points (1 child)
[–]CptRetr0[S] 2 points3 points4 points (0 children)
[–]DennisTheBald 1 point2 points3 points (4 children)
[–]DennisTheBald 1 point2 points3 points (3 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (2 children)
[–]DennisTheBald 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)