Gathering Phone Information

I’m trying to come up with a Powershell script that will pull phone information and dump it into a .csv file. I’m still very new at Powershell so I’m gathering the pieces together but having problems getting all the pieces to fit. Fist, I have a list of IPs in a text file to use for a variable:

$IP = (Get-Content -Path "path-to-ip-text-file.txt") 

Next, I can read the web based XML files using the variable I created:

Invoke-WebRequest "http://$IP/config.xml" 

The XML file looks like this (starting few lines):

<flat-profile> <Connection_Type group="Info/System_Information">DHCP</Connection_Type> <Current_IP group="Info/System_Information">192.168.100.111</Current_IP> <Host_Name group="Info/System_Information">Phone1</Host_Name> <Domain group="Info/System_Information">domain.local</Domain> <Current_Netmask group="Info/System_Information">255.255.255.0</Current_Netmask> <Current_Gateway group="Info/System_Information">192.168.100.1</Current_Gateway> <Primary__DNS group="Info/System_Information">192.168.100.230</Primary__DNS> <Secondary__DNS group="Info/System_Information">192.168.100.231 </Secondary__DNS> <yadda yadda yadda> </flat-profile> 

The question is how do I pull specific information from the XML file on all of these phones and dump it into a .csv file? Kind of a broad questions, I know, but as I said I’m still very new at this.

submitted by /u/The-Dark-Jedi
[link] [comments]

Leave a Reply