XML how to get specific data from File.. (cant find a simple solution)

Hello Peeps,

I have a XML file that looks like this: (FileName is LP0024.xml)

===============================================================
||| <?xml version="1.0" encoding="utf-8"?> |||

I need to Obtain the Following:
C09100
C09102
COW0654
COW0660
COW0655
COW0651
COW0652
COW0653

Need to Copy this info into a file Named as “LP00224.TXT”

I am no XML or Powershell Expert but I find Codes online that I can put to Use, How ever I can not find any Script for me to construct and succesfully get that DATA out into a File…

I am using Windows10 x64 With latest Powershell.

Why Do i Ask?
A: We Use Dynamic Environment Management Console to Connect Printers to Computers. Now I made a PSscript where I can tye a Computername And it will Show me All the Printers that are connected to this computer and store this info in a TXT file with the name of the Computer.

Now i want to Reverse this by Searching for Printers and find me the Connected Computers and store this in a TXT file named as the Printer i searched for…

Summery:
The XML tekst I Pasted above: File name is LP0024 (just one of the 1000 printers we use) and is a XML and all connected Computers are in that File… Need to get that info into a Txt file…

is anybody outthere that knows how to? Like i said tried many things but none show me the Computername (just the computername)

thank you very much for your Time!!!

Greetz,

michel ICT

Michel,
Welcome to the forum. :wave:t4:

As you can see the forum software messed up the sample data you posted because you did not format it correctly as code. :point_up_2:t4:

Please go back, edit your question and fix that. To post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org <---- Click :point_up_2:t4: :wink:

Regardless of that - as far as I can see you did not post any of your code. This forum is for scripting questions about self written code rather than script requests. We do not write customized and ready to use scripts or solutions on request.

What have you tried so far? We expect you to make an own attempt to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

Hello Olaf…

because i am a Noob and have no idea how this forum works… Like Editing/Closing/Replying… Etc… I have decided to cancel my question until i fully understand what i am doing…

I know I cant ask someone to Code for me… but it tried al lot straight from the prompt to reach that value but nothing gave succes…

Any way How can i close this topic… I will make a new one once i understand how this all works. haha… so sorry for all trouble but thx a million…

If it is possible and you can close this topic for me would be much appriciated… thx…

Gr
Michel

That’s ok. We all started once. :wink:

Underneath each post you have some icons like a heart and a segment of a chain … and 3 points … that’s where you can unfold all possible options for this particular post. On of the icons is a pen. With that pen you open the post editor. :+1:t4: