Last active
April 10, 2018 12:56
-
-
Save psrdrgz/41ac17a4a438ee0c247d294779698c55 to your computer and use it in GitHub Desktop.
A script to document all the software properties and settings including Software Name, Content Location, Installation program (command), the Uninstall program (command), and dependencies.
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
function Get-ConfigMgrSite | |
{ | |
[cmdletbinding()] | |
Param() | |
Begin{} | |
Process{ | |
$ManagementPointSearcher = [adsisearcher]'ObjectClass=mssmsmanagementpoint' | |
$ManagementPointADObject = $ManagementPointSearcher.FindOne().GetDirectoryEntry() | |
[pscustomobject]@{ | |
SiteServer = $ManagementPointADObject.mssmsmpname[0] | |
SiteCode = $ManagementPointADObject.mssmssitecode[0] | |
PSTypeName = 'ARTools.ConfigMgrSite' | |
} | |
} | |
End{} | |
} | |
function Get-ConfigMgrAppInfo | |
{ | |
[cmdletbinding()] | |
Param( | |
[Parameter(Mandatory = $True,ValueFromPipelineByPropertyName = $True)] | |
[Alias('LocalizedDisplayName')] | |
[ArgumentCompleter({ | |
$TextToComplete = $args[2] | |
$CMSite = Get-ConfigMgrSite | |
$CompletionOptions = Get-WmiObject -ComputerName $CMSite.SiteServer -Namespace "root\SMS\site_$($CMSite.SiteCode)" -Class SMS_Application -Filter 'IsLatest=1' -ErrorAction SilentlyContinue | | |
Select-Object -ExpandProperty LocalizedDisplayName | | |
Sort-Object | |
foreach ($Item in $CompletionOptions.Where({$_ -like "*$TextToComplete*"})) | |
{ | |
[CompletionResult]::new("`"$Item`"", $Item, [CompletionResultType]::ParameterValue, $Item) | |
} | |
})] | |
[string]$ApplicationName, | |
[Parameter()] | |
[switch]$Raw | |
) | |
Begin{ | |
Push-Location | |
Connect-ConfigMgr | |
} | |
Process{ | |
Get-CMApplication -Name $ApplicationName | | |
ForEach-Object -Process { | |
[Microsoft.ConfigurationManagement.ApplicationManagement.Serialization.SccmSerializer]::Deserialize($_.SDMPackageXML) | | |
Foreach-Object -Process{ | |
If(-not $Raw) | |
{ | |
$ApplicationName = $_.Title | |
$_.DeploymentTypes | | |
Select-Object -Property @{n='ApplicationName';e={$ApplicationName}}, | |
@{n='DeploymentTypeName';e={$_.Title}}, | |
@{n='InstallCommandLine';e={$_.Installer.InstallCommandLine}}, | |
@{n='UninstallCommandLine';e={$_.Installer.UninstallCommandLine}}, | |
@{n='ContentLocation';e={$_.Installer.Contents.Location}}, | |
@{n='Requirements';e={$_.Requirements.Name -join ",`r`n"}}, | |
@{n='Dependencies';e={$_.Dependencies.Name -join ",`r`n"}} | |
} | |
Else{$_} | |
} | |
} | |
} | |
End{ | |
Pop-Location | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment