Last active
April 9, 2020 15:51
-
-
Save steviecoaster/ffb8223501183bf9eb5920838091236e to your computer and use it in GitHub Desktop.
Choco Audit Object
This file contains hidden or 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
| function ConvertTo-ChocoObject { | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter(ValueFromPipeline)] | |
| [string]$InputObject | |
| ) | |
| Process { | |
| # format of the 'choco list -lo -r' output is: | |
| # full info with 'choco list -lo -r --audit | |
| # <PACKAGE NAME>|<VERSION> (ie. adobereader|2015.6.7) | |
| if (-not [string]::IsNullOrEmpty($InputObject)) { | |
| $props = $_.split('|') | |
| [pscustomobject]@{ | |
| name = $props[0] | |
| version = $props[1] | |
| #The following get picked up with using the --audit flag in C4B. | |
| InstalledBy = $props[2] -replace ('User:','') | |
| Domain = $props[3] -replace ('Domain:','') | |
| RequestedBy = $props[4] -replace ('Original User:','') | |
| 'InstallDate(UTC)' = $props[5] -replace ('InstallDateUtc:','') | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment