Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

PowerShell Separating Table Variable

$
0
0

Not even sure if i am describing this right. But basically i want to take a query and this can be any query into a ForEach loop. But the caveat is the query needs to separate one part of the variable and those alike into separate tables.

Example:

Powershell
$Servers=Get-ContentC:\SomeLocation.txt
Powershell
$NICs=Get-WmiObject-ClassWin32_OperatingSystem-ComputerName$Server-ErrorActionStop
Powershell
foreach($NICin$NICs){
Powershell
$qName=$NIC.Caption
Powershell
$qBuild=$NIC.BuildNumber


In this instance I would like to match all Server 2012 w/ ComputerName in Table1

match all Server 2008R2 w/ ComputerName in Table 2. etc, etc.

Full code is something like this:

Powershell
$headerNames2|foreach{
Powershell
$tableEntry2+=""
Powershell
$NICs=Get-WmiObject-ClassWin32_OperatingSystem-ComputerName$Server-ErrorActionStop
...

Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>