Returns resultant set of policy Application Management setting information for a computer. This script contributed by Mike Stephens of Microsoft.
Const FL_FORCE_CREATE_NAMESPACE = 4 strComputer = "." Set wDate = CreateObject("WbemScripting.SWbemDateTime") Set locator = CreateObject("WbemScripting.SWbemLocator") Set connection = locator.ConnectServer( strComputer, "root\rsop", null, null, null, null, 0, null) Set provider = connection.Get("RsopLoggingModeProvider") provider.RsopCreateSession FL_FORCE_CREATE_NAMESPACE, Null, namespaceLocation, hResult, eInfo Set rsopProv = locator.ConnectServer _ (strComputer, namespaceLocation & "\Computer", null, null, Null, Null, 0 , Null) WScript.Echo "Computer RSOP of Application Management Settings" Set colItems = rsopProv.ExecQuery("Select * from RSOP_ApplicationManagementPolicySetting") For Each objItem in colItems WScript.Echo String (50, "=") Wscript.Echo "Allow X86 on IA64: " & objItem.AllowX86OnIA64 Wscript.Echo "Application ID: " & objItem.ApplicationId Select Case objItem.ApplyCause Case 1 WScript.Echo "Cause: Application Assigned (1)" Case 2 WScript.Echo "Cause: User installed via Add/Remove Programs (2)" Case 3 WScript.Echo "Cause: Installed in User Profile (3)" Case 4 WScript.Echo "Cause: Installed using File Extension (4)" Case 5 WScript.Echo "Cause: Installed using CLSID activation (5)" Case 6 WScript.Echo "Cause: Application was a forced upgrade (6)" Case 7 WScript.Echo "Cause: Application was installed using ProgID (7)" Case 8 WScript.Echo "Cause: Application was redeployed (8)" End Select Select Case objItem.AssignmentType Case 1 WScript.Echo "Assignment Type: Not assigned (1)" Case 2 WScript.Echo "Assignment Type: Advertised (2)" Case 3 WScript.Echo "Assignment Type: Installed at Logon (3)" End Select 'WScript.Echo "Categories: " & objItem.Categories Wscript.Echo "Demand Installable: " & objItem.DemandInstallable wDate.Value = objItem.DeploymentLastModifyTime Wscript.Echo "Deployment Last Modify Time: " & FormatDateTime( wDate.GetVarDate(), vbShortDate) & " " & _ FormatDateTime(wDate.GetVarDate(), vbShortTime) Select Case objItem.DeploymentType Case 1 WScript.Echo "Deployment Type: Assigned (1)" Case 2 WScript.Echo "Deployment Type: Published (2)" End Select Wscript.Echo "Display in Add/Remove Programs: " & objItem.DisplayInARP Select Case objItem.Eligibility Case 1 Wscript.Echo "Eligibility: Assigned (1)" Case 2 Wscript.Echo "Eligibility: Applied to user profile (2)" Case 3 Wscript.Echo "Eligibility: Potential Upgrade (3)" Case 4 Wscript.Echo "Eligibility: Conditional (4)" End Select Select Case objItem.EntryType Case 1 Wscript.Echo "Entry Type: Applied (1)" Case 2 Wscript.Echo "Entry Type: Removed (2)" Case 3 Wscript.Echo "Entry Type: Add/Remove Programs (3)" End Select Wscript.Echo "ID: " & objItem.ID Wscript.Echo "Ignore Language: " & objItem.IgnoreLanguage Select Case objItem.InstallationUI Case 1 Wscript.Echo "Installation UI: Basic (1)" Case 2 Wscript.Echo "Installation UI: Maximum (2)" End Select Wscript.Echo "Language ID: " & objItem.LanguageId Select Case objItem.LanguageMatch Case 1 Wscript.Echo "Language Match: Matches System (1)" Case 2 Wscript.Echo "Language Match: English (2)" Case 3 Wscript.Echo "Language Match: Language Ignored (3)" Case 4 Wscript.Echo "Language Match: Neutral (4)" Case 5 Wscript.Echo "Language Match: No Match (5)" End Select Select Case objItem.LossOfScopeAction Case 1 Wscript.Echo "Loss of Scope Action: Uninstall (1)" Case 2 Wscript.Echo "Loss of Scope Action: Unmanage (2)" End Select For Each strArchitecture in objItem.MachineArchitectures Wscript.Echo "Machine Architecture: " & strArchitecture Next Wscript.Echo "On-demand CLSID: " & objItem.OnDemandClsid Wscript.Echo "On-demand File Extension: " & objItem.OnDemandFileExtension Wscript.Echo "On-demand ProgID: " & objItem.OnDemandProgId Wscript.Echo "Package Location: " & objItem.PackageLocation Select Case objItem.PackageType Case 1 Wscript.Echo "Package Type: Windows Installer (1)" Case 2 Wscript.Echo "Package Type: Zap File (2)" End Select Wscript.Echo "Precedence: " & objItem.Precedence Select Case objItem.PrecedenceReason Case 1 Wscript.Echo "Precedence Reason: Language Match (1)" Case 2 Wscript.Echo "Precedence Reason: ProdID Conflict (2)" Case 4 Wscript.Echo "Precedence Reason: Upgrade (4)" Case 5 Wscript.Echo "Precedence Reason: Highest (5)" Case 6 Wscript.Echo "Precedence Reason: NonForced (6)" End Select Wscript.Echo "Product ID: " & objItem.ProductId Wscript.Echo "Publisher: " & objItem.Publisher Wscript.Echo "Redeploy Count: " & objItem.RedeployCount Select Case objItem.RemovalCause Case 1 Wscript.Echo "Removal Cause: Not Removed (1)" Case 2 Wscript.Echo "Removal Cause: Upgraded (2)" Case 3 Wscript.Echo "Removal Cause: Remove by Administrator (3)" Case 4 Wscript.Echo "Removal Cause: Removed by User (4)" Case 5 Wscript.Echo "Removal Cause: Out of Scope (5)" Case 6 Wscript.Echo "Removal Cause: Transform Conflict (6)" Case 7 Wscript.Echo "Removal Cause: Product Conflict (7)" Case 8 Wscript.Echo "Removal Cause: Removed due to Romaing Profile (8)" End Select Select Case objItem.RemovalType Case 1 Wscript.Echo "Removal Type: Not Removed (1)" Case 2 Wscript.Echo "Removal Type: Upgraded (2)" Case 3 Wscript.Echo "Removal Type: Uninstalled (3)" Case 4 Wscript.Echo "Removal Type: Unmanaged (4)" End Select Wscript.Echo "Removing Application: " & objItem.RemovingApplication Wscript.Echo "Replaceable Applications: " & objItem.ReplaceableApplications Wscript.Echo "Script File: " & objItem.ScriptFile Wscript.Echo "Support URL: " & objItem.SupportURL Wscript.Echo "Transforms: " & objItem.Transforms Wscript.Echo "Uninstall Unmanaged: " & objItem.UninstallUnmanaged Wscript.Echo "Upgradeable Applications: " & objItem.UpgradeableApplications Wscript.Echo "Upgrade Settings Mandatory: " & objItem.UpgradeSettingsMandatory Wscript.Echo "Version Number (High): " & objItem.VersionNumberHi Wscript.Echo "Version Number (Low): " & objItem.VersionNumberLo Next provider.RsopDeleteSession namespaceLocation, hResult
Const FL_FORCE_CREATE_NAMESPACE = 4 strComputer = "." Set wDate = CreateObject("WbemScripting.SWbemDateTime") Set locator = CreateObject("WbemScripting.SWbemLocator") Set connection = locator.ConnectServer( strComputer, "root\rsop", null, null, null, null, 0, null) Set provider = connection.Get("RsopLoggingModeProvider") provider.RsopCreateSession FL_FORCE_CREATE_NAMESPACE, Null, namespaceLocation, hResult, eInfo Set rsopProv = locator.ConnectServer _ (strComputer, namespaceLocation & "\Computer", null, null, Null, Null, 0 , Null) WScript.Echo "Computer RSOP of Application Management Settings" Set colItems = rsopProv.ExecQuery("Select * from RSOP_ApplicationManagementPolicySetting") For Each objItem in colItems WScript.Echo String (50, "=") Wscript.Echo "Allow X86 on IA64: " & objItem.AllowX86OnIA64 Wscript.Echo "Application ID: " & objItem.ApplicationId Select Case objItem.ApplyCause Case 1 WScript.Echo "Cause: Application Assigned (1)" Case 2 WScript.Echo "Cause: User installed via Add/Remove Programs (2)" Case 3 WScript.Echo "Cause: Installed in User Profile (3)" Case 4 WScript.Echo "Cause: Installed using File Extension (4)" Case 5 WScript.Echo "Cause: Installed using CLSID activation (5)" Case 6 WScript.Echo "Cause: Application was a forced upgrade (6)" Case 7 WScript.Echo "Cause: Application was installed using ProgID (7)" Case 8 WScript.Echo "Cause: Application was redeployed (8)" End Select Select Case objItem.AssignmentType Case 1 WScript.Echo "Assignment Type: Not assigned (1)" Case 2 WScript.Echo "Assignment Type: Advertised (2)" Case 3 WScript.Echo "Assignment Type: Installed at Logon (3)" End Select 'WScript.Echo "Categories: " & objItem.Categories Wscript.Echo "Demand Installable: " & objItem.DemandInstallable wDate.Value = objItem.DeploymentLastModifyTime Wscript.Echo "Deployment Last Modify Time: " & FormatDateTime( wDate.GetVarDate(), vbShortDate) & " " & _ FormatDateTime(wDate.GetVarDate(), vbShortTime) Select Case objItem.DeploymentType Case 1 WScript.Echo "Deployment Type: Assigned (1)" Case 2 WScript.Echo "Deployment Type: Published (2)" End Select Wscript.Echo "Display in Add/Remove Programs: " & objItem.DisplayInARP Select Case objItem.Eligibility Case 1 Wscript.Echo "Eligibility: Assigned (1)" Case 2 Wscript.Echo "Eligibility: Applied to user profile (2)" Case 3 Wscript.Echo "Eligibility: Potential Upgrade (3)" Case 4 Wscript.Echo "Eligibility: Conditional (4)" End Select Select Case objItem.EntryType Case 1 Wscript.Echo "Entry Type: Applied (1)" Case 2 Wscript.Echo "Entry Type: Removed (2)" Case 3 Wscript.Echo "Entry Type: Add/Remove Programs (3)" End Select Wscript.Echo "ID: " & objItem.ID Wscript.Echo "Ignore Language: " & objItem.IgnoreLanguage Select Case objItem.InstallationUI Case 1 Wscript.Echo "Installation UI: Basic (1)" Case 2 Wscript.Echo "Installation UI: Maximum (2)" End Select Wscript.Echo "Language ID: " & objItem.LanguageId Select Case objItem.LanguageMatch Case 1 Wscript.Echo "Language Match: Matches System (1)" Case 2 Wscript.Echo "Language Match: English (2)" Case 3 Wscript.Echo "Language Match: Language Ignored (3)" Case 4 Wscript.Echo "Language Match: Neutral (4)" Case 5 Wscript.Echo "Language Match: No Match (5)" End Select Select Case objItem.LossOfScopeAction Case 1 Wscript.Echo "Loss of Scope Action: Uninstall (1)" Case 2 Wscript.Echo "Loss of Scope Action: Unmanage (2)" End Select For Each strArchitecture in objItem.MachineArchitectures Wscript.Echo "Machine Architecture: " & strArchitecture Next Wscript.Echo "On-demand CLSID: " & objItem.OnDemandClsid Wscript.Echo "On-demand File Extension: " & objItem.OnDemandFileExtension Wscript.Echo "On-demand ProgID: " & objItem.OnDemandProgId Wscript.Echo "Package Location: " & objItem.PackageLocation Select Case objItem.PackageType Case 1 Wscript.Echo "Package Type: Windows Installer (1)" Case 2 Wscript.Echo "Package Type: Zap File (2)" End Select Wscript.Echo "Precedence: " & objItem.Precedence Select Case objItem.PrecedenceReason Case 1 Wscript.Echo "Precedence Reason: Language Match (1)" Case 2 Wscript.Echo "Precedence Reason: ProdID Conflict (2)" Case 4 Wscript.Echo "Precedence Reason: Upgrade (4)" Case 5 Wscript.Echo "Precedence Reason: Highest (5)" Case 6 Wscript.Echo "Precedence Reason: NonForced (6)" End Select Wscript.Echo "Product ID: " & objItem.ProductId Wscript.Echo "Publisher: " & objItem.Publisher Wscript.Echo "Redeploy Count: " & objItem.RedeployCount Select Case objItem.RemovalCause Case 1 Wscript.Echo "Removal Cause: Not Removed (1)" Case 2 Wscript.Echo "Removal Cause: Upgraded (2)" Case 3 Wscript.Echo "Removal Cause: Remove by Administrator (3)" Case 4 Wscript.Echo "Removal Cause: Removed by User (4)" Case 5 Wscript.Echo "Removal Cause: Out of Scope (5)" Case 6 Wscript.Echo "Removal Cause: Transform Conflict (6)" Case 7 Wscript.Echo "Removal Cause: Product Conflict (7)" Case 8 Wscript.Echo "Removal Cause: Removed due to Romaing Profile (8)" End Select Select Case objItem.RemovalType Case 1 Wscript.Echo "Removal Type: Not Removed (1)" Case 2 Wscript.Echo "Removal Type: Upgraded (2)" Case 3 Wscript.Echo "Removal Type: Uninstalled (3)" Case 4 Wscript.Echo "Removal Type: Unmanaged (4)" End Select Wscript.Echo "Removing Application: " & objItem.RemovingApplication Wscript.Echo "Replaceable Applications: " & objItem.ReplaceableApplications Wscript.Echo "Script File: " & objItem.ScriptFile Wscript.Echo "Support URL: " & objItem.SupportURL Wscript.Echo "Transforms: " & objItem.Transforms Wscript.Echo "Uninstall Unmanaged: " & objItem.UninstallUnmanaged Wscript.Echo "Upgradeable Applications: " & objItem.UpgradeableApplications Wscript.Echo "Upgrade Settings Mandatory: " & objItem.UpgradeSettingsMandatory Wscript.Echo "Version Number (High): " & objItem.VersionNumberHi Wscript.Echo "Version Number (Low): " & objItem.VersionNumberLo Next provider.RsopDeleteSession namespaceLocation, hResult