I want to get the variable I will use from xml thru powershell. Please see my sample code below.
Powershell :
$Hostname = (Get-WmiObject Win32_Computersystem).name
$IPAddress = ((ipconfig | findstr [0-9].\.)[0]).Split()[-1]
$Date=Get-Date -format "yyyy-MM-dd HH:mm:ss"
[xml]$ConfigFile = Get-Content "C:\Settings.xml"
Write-Host $ConfigFile.Management.Printme
XML :
<?xml version="1.0"?>
<Management>
<Printme>
$Hostname | $IPAddress
</Printme>
</Management>
This is a sample code only. I have 3 variable on my powershell and I want to get what variable to use from my xml file. Can you give me a hint on how I will do this. As you can see the result of my above code is $Hostname | $IPAddress text instead of the value of $Hostname and $IPAddress. Thank you.
I am thinking to use -split and put it on array.