Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .DESCRIPTION
- This works with JSON files created by export_computerinfo.ps1
- #>
- $LogLocation = "\\samepath\as\export-computerinfo.ps1\"
- $JSONFiles = Get-ChildItem -Path $LogLocation -Filter "*.json"
- $AllComputerInfo = @()
- if($JSONFiles) {
- foreach($JSON in $JSONFiles) {
- $JSONContent = Get-Content -Path $JSON.FullName -Raw -Encoding "UTF8" | ConvertFrom-Json
- if($JSONContent.Monitors.length -ge 0) {
- foreach($Monitor in $JSONContent.Monitors) {
- if($Monitor -ne $null) {
- $AllComputerInfo += [PSCustomObject]@{
- Manufacturer = $Monitor.Manufacturer
- Model = $Monitor.UserFriendlyName
- Name = $Monitor.UserFriendlyName
- SystemSKUNumber = $Monitor.UserFriendlyName
- PrimaryOwnerName = $JSONContent.PrimaryOwnerName
- SerialNumber = $Monitor.SerialNumberID
- }
- }
- }
- }
- $AllComputerInfo += $JSONContent | Select-Object -Property * -ExcludeProperty Monitors
- }
- $AllComputerInfo | Select-Object -Property * -Unique | Sort-Object PrimaryOwnerName | Export-Csv -Path "AllComputerInfo.csv" -NoTypeInformation -NoClobber -Encoding "UTF8"
- }
Add Comment
Please, Sign In to add comment