Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
I have a function that creates a list of IP addresses. I want to take that function and have another function read the list and do something. Maybe I do not need a Function at all but I still want to take the output and run it against another script. the code is below.
You need to spend some time studying how to design functions and scripts. YOu are just taking some arbitrary commandline code and wrapping it in a function block. This may work but it is not very useful.
If you want to use function output, you should not pipe the output into format list, since this is a string format.
You should use it a natively as possible to preserve the object properties.
Your function does not return anything, right? Thats because you'rs saving the outoput into a variable thats gone after the function call. Use something like this (See the usefull name?) to list your computer IPs.
You might also considering changing the main loop from a piped foreach to a real foreach, and creating a Object array, that makes the handling of your complex wmi-call easier and the data is not just displayed but also (re-) usable.
I would also use the Version instead of the Caption:
Version : 6.1.7601
your script does not output anything. I have been working on this and i am trying to gather informtion on different plug-ins and software version. I wrote the script below as a full function. it outputs the information in a way that i need but from my understanding it will not be (re-) usable. It porduces th output below. It gives to me by computer. So it gives the information of all software on one computer outputs the information then gives me the next computers information. Please keep in mind that i am still fairly new at this and teaching myself by reading so I may have missed a step somewhere.
torpedro,
I got an output from your script when not using the function part. So my question is why does it not work with the list of IP's in memory. Am I missing something?
This topic is 11 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.