-
-
Save anonymous/3cbe2a48f7b1e1af4733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. .\Get-ProductKey.ps1 | |
$InputCSV = import-csv .\Input.csv -Header Name | |
$OutputCSV = @() | |
$Keys =@() | |
foreach ($PC in $InputCSV) | |
{ | |
$objResult = Get-ProductKey -Computername $PC.name | |
$checkResult = $Keys -contains $objResult.ProductKey | |
$Keys += $objResult.ProductKey | |
$objResult | Add-Member -type NoteProperty -name Duplicate -value $checkResult | |
$OutputCSV = $OutputCSV + $objResult | |
} | |
$OutputCSV | Select-object Computername,OSDescription,ProductKey,Duplicate | export-csv -path .\Output.csv -noType -encoding UTF8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment