Overblog
Editer l'article Suivre ce blog Administration + Créer mon blog

Get-CMAppsSrcPath

Publié le par damcuvelier

$SCCMServer = "Nom_du_serveur_SCCM"
$X = '5'
$Global:here = 'C:\'
$Global:CMDrive = (get-location).path # if running in SCCM Console
set-location $here
$SITECODE = $CMDrive.split(':')[0]
$Namespace = "root\sms\site_$SITECODE"

set-location $CMDrive
# Localization of $X applications les plus récentes :
$CMAppsQuery = "SELECT TOP $X * FROM SMS_Application ORDER BY DateCreated DESC"
$CMApplicationPaths += foreach ($App in (Get-WmiObject -ComputerName $SCCMServer -Namespace $Namespace -Query $CMAppsQuery)) {
    $SDMPackageXML = (Get-CMApplication -name $App).SDMPackageXML
    ([xml]$SDMPackageXML).AppMgmtDigest.DeploymentType.Installer.Contents.Content.Location
}
set-location $here
$CMApplicationPaths = $CMApplicationPaths.trimend(';')
$CMAppsSrcPath = $CMApplicationPaths.split(';') | Select-Object | get-unique
$CMAppsSrcPath

Commenter cet article