I am learning PowerShell scripting. One of my stumbling blocks in learning is how to properly get data, and then using it later in the script.
For example. I need to get the GUID for a connected NIC. I can run the following which will get me the information.
get-wmiobject win32_networkadapter -filter "netconnectionstatus = 2" | select-object guid
However I would like to take that GUID store it in a variable to be called later. However when I do that I get additional information like:
This presents an issue when I attempt to use it a different part of the script like this:
$GUID = get-wmiobject win32_networkadapter -filter "netconnectionstatus = 2" | select-object guid
Please help shed some light on how to achieve this.