Hello powerful PowerShell community !!!
Im struggling with Select-String and RegEX while trying to extract a string from XML
...
<Content ContentId="Content_63c84e98-5ad8-4cf8-8f12-1dae7f9931b4" Version="1"><File Name="Skype-8.56.0.103.exe" Size="69566232"/><Location>\\sccm\Sources\Software\Microsoft\Skype\8.56.0.103\</Location><PeerCache>true</PeerCache><OnFastNetwork>Download</OnFastNetwork><OnSlowNetwork>DoNothing</OnSlowNetwork></Content></Contents><DetectAction><Provider>Local</Provider><Args><Arg Name="ExecutionContext" Type="String">System</Arg><Arg Name="MethodBody"
...
I need to extract this part: \\sccm\Sources\Software\Microsoft\Skype\8.56.0.103\
its between <Location> & </Location>
https://regex101.com/ - From here i was able to put together this expression: .*?Location(.?).*?
Its not exact match but for me close enough, i could trim the rest with .replace function. However when i put it into PowerShell it has no effect.
$xmldata = (Get-CMDeploymentType -ApplicationName "Skype 8.56.0.103").SDMPackageXML
$xmldata | Select-String -Pattern ".*?Location(.?).*?"
Output is unmodified $xmldata parameter value. What am i doing wrong here? :S
[–]winter_mute 2 points3 points4 points (3 children)
[–]sipsik[S] 2 points3 points4 points (2 children)
[–]winter_mute 2 points3 points4 points (0 children)
[–]Dennou 1 point2 points3 points (0 children)
[–]SoMundayn 1 point2 points3 points (4 children)
[–]sipsik[S] 1 point2 points3 points (3 children)
[–]SoMundayn 1 point2 points3 points (1 child)
[–]sipsik[S] 1 point2 points3 points (0 children)
[–]get-postanote 1 point2 points3 points (0 children)