Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

How To Stop Windows Services Using Result From XML File

$
0
0

Hi,

I'm trying to parse xml files in a directory with the following script.  For example, in the xml i have data that looks like the following called service.xml

displayName="blahblahblah"

get-childitem -Path c:\service.xml | foreach { [xml]$xml=get-content $_; if ($xml.config.service.displayname) {$xml.config.service.displayname} }

When I run the script I will get result as the following

blahblahblah

So let's say there is a windows service displayname called blahblahblah, how can i use the xml result to stop and start the service using the displayname.

Thanks,

Daniel


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>