Guest User

Untitled

a guest
May 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <#
  2. .DESCRIPTION
  3. This works with JSON files created by export_computerinfo.ps1
  4. #>
  5. $LogLocation = "\\samepath\as\export-computerinfo.ps1\"
  6. $JSONFiles = Get-ChildItem -Path $LogLocation -Filter "*.json"
  7. $AllComputerInfo = @()
  8. if($JSONFiles) {
  9. foreach($JSON in $JSONFiles) {
  10. $JSONContent = Get-Content -Path $JSON.FullName -Raw -Encoding "UTF8" | ConvertFrom-Json
  11. if($JSONContent.Monitors.length -ge 0) {
  12. foreach($Monitor in $JSONContent.Monitors) {
  13. if($Monitor -ne $null) {
  14. $AllComputerInfo += [PSCustomObject]@{
  15. Manufacturer = $Monitor.Manufacturer
  16. Model = $Monitor.UserFriendlyName
  17. Name = $Monitor.UserFriendlyName
  18. SystemSKUNumber = $Monitor.UserFriendlyName
  19. PrimaryOwnerName = $JSONContent.PrimaryOwnerName
  20. SerialNumber = $Monitor.SerialNumberID
  21. }
  22. }
  23. }
  24. }
  25. $AllComputerInfo += $JSONContent | Select-Object -Property * -ExcludeProperty Monitors
  26. }
  27. $AllComputerInfo | Select-Object -Property * -Unique | Sort-Object PrimaryOwnerName | Export-Csv -Path "AllComputerInfo.csv" -NoTypeInformation -NoClobber -Encoding "UTF8"
  28. }
Add Comment
Please, Sign In to add comment