smsclictr.automation library
Get a local Advertisement policy as ManagementObject

Namespace:  smsclictr.automation
Assembly:  smsclictr.automation(in smsclictr.automation.dll) Version: 1.1.3731.16627 (1.1.2.4)

Syntax

C#
public 
ManagementObject 
GetAdvert(
	
string 
ADV_AdvertisementId,
	
string 
PKG_PackageId,
	
string 
PRG_ProgramId
)

Parameters

ADV_AdvertisementId
Type: System . . :: . String
Advertisement ID
PKG_PackageId
Type: System . . :: . String
Package ID
PRG_ProgramId
Type: System . . :: . String
Program ID (Program Name)

Return Value

A ManagementObject with the local Advertisement Settings (root\ccm\Policy\Machine\ActualConfig:CCM_SoftwareDistribution)

Remarks

Policy Properties:

CopyC#
ADV_ActiveTime
ADV_ActiveTimeIsGMT
ADV_ADF_Published
ADV_AdvertisementID
ADV_FirstRunBehavior
ADV_MandatoryAssignments
ADV_RCF_InstallFromLocalDPOptions
ADV_RCF_InstallFromRemoteDPOptions
ADV_RCF_PostponeToAC
ADV_RepeatRunBehavior
PKG_ContentSize
PKG_Language
PKG_Manufacturer
PKG_MIFChecking
PKG_MifFileName
PKG_MIFName
PKG_MIFPublisher
PKG_MIFVersion
PKG_Name
PKG_PackageID
PKG_PSF_ContainsSourceFiles
PKG_SourceHash
PKG_SourceVersion
PKG_version
PRG_CommandLine
PRG_Comment
PRG_DependentPolicy
PRG_ForceDependencyRun
PRG_HistoryLocation
PRG_MaxDuration
PRG_PRF_AfterRunning
PRG_PRF_Disabled
PRG_PRF_InstallsApplication
PRG_PRF_MappedDriveRequired
PRG_PRF_PersistMappedDrive
PRG_PRF_RunWithAdminRights
PRG_PRF_ShowWindow
PRG_PRF_UserInputRequired
PRG_PRF_UserLogonRequirement
PRG_ProgramID
PRG_ProgramName
PRG_Requirements
PRG_ReturnCodesSource
PRG_WorkingDirectory

Examples

C#:
CopyC#
using System;
using
System.Collections.Generic;
using System.Text;
using smsclictr.automation;

namespace
ConsoleApplication1
{

class Program
		{
		
static 
void Main(
string[] args)
				{
					 SMSClient oClient = 
new SMSClient(
"localhost");
					 ManagementObject Adv =
oClient.SoftwareDistribution.GetAdvert(
"LAB20001", 
"LAB00003", 
"DIR");
					 Console.WriteLine(Adv.GetPropertyValue(

"PRG_CommandLine").ToString());
			}
		 }
}
PowerShell:

(copy smsclictr.automation.dll to the %HOMEDRIVE%\%HOMEPATH% Folder of the current User)

CopyC#
[

void][System.Reflection.Assembly]::LoadFile(

"$HOME\smsclictr.automation.dll")
$SMSClient = New-Object -TypeName smsclictr.automation.SMSClient(
"localhost")
$SMSClient.SoftwareDistribution.GetAdvert(
"LAB20001", 
"LAB00003", 
"DIR").PRG_CommandLine

See Also