data structure for powershell script -
I am trying to write a power-shell script that will take in a text file (or xml file) or whatever I I want to see the list of server names and some server names to read in a row from PowerShell to a text file, but I did not know the powers to import data into different variables How do I pass other functions for If it is argued that it looks trivial, but should be a simple way for me rather than to use a regex on each line to do so.
"post-text" itemprop = "Consider the following XML:
$ xml = [xml] @" server " Server name = "server1" & gt; & Lt; Process & gt; Process 1 & lt; / Projection & gt; Process & gt; Process 2 & lt; / Process & gt; & Lt; / Server & gt; Server name = "server2" & gt; Process & gt; Process 3 & lt; / Process & gt; & Lt; / Server & gt; & Lt; / Server & gt; "@
You can process the $ xml
variable like this:
foreach ($ xml.Servers.Server In $ server) {foreach ($ Process $ $ process.process) {# Run your murder script here.}}
For a kill script on remote machines, you can attach attach- You can use cmdlet (PSRemoting enabled), or PsExec, or WMI, which are most comfortable with you, $ server
and $ process
But execute murder against the right procedure He will need.
Comments
Post a Comment