Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
- # inline xml:
- $xml = [xml]@"
- <workplaces>
- <computer id="F">
- <ou></ou>
- <title>Flexible</title>
- </computer>
- <computer id="B">
- <ou></ou>
- <title>Business</title>
- </computer>
- </workplaces>
- "@
- # xml in file:
- $xml = [xml](gc "testfile.xml")
- # read computer type from the task sequence
- $workplace= $tsenv.Value("Workplace")
- # query the xml
- $title = ($xml.workplaces.computer | where { $_.id -ieq "B" }).title
- $ou = ($xml.workplaces.computer | where { $_.id -ieq "$workplace" }).ou
- # write SCCM task sequence variabele
- $tsenv.Value("OU") = $ou
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement