System Center Scripting


TechNet Script Center Gallery Contributions


Before connecting to the SMS Provider for a local or remote Configuration Manager 2007 site server, you first need to locate the SMS Provider for the site server. The SMS Provider can be either local or remote to the Configuration Manager site server you are using.
In Microsoft System Center Configuration Manager 2007, you read a Configuration Manager object by using the SWbemServices object Get method to return an object instance that is identified by a key value.
You modify a Configuration Manager object, in Microsoft System Center Configuration Manager 2007, by using the object's SWbemObject object to change its properties.
To delete a Microsoft System Center Configuration Manager 2007 object, in Configuration Manager 2007, call the SWbemObject object Delete method.
In Microsoft System Center Configuration Manager 2007, you perform an synchronous query for Configuration Manager objects by calling the SWbemServices object ExecQueryAsync method and by implementing a sink method to handle query results.
To read a lazy property from a Microsoft System Center Configuration Manager 2007 object returned in a query, you get the object instance, which in turn retrieves any lazy object properties from the SMS Provider.
To call a SMS Provider class method, in Configuration Manager 2007, you use the SWbemServices object ExecMethod method to call methods that are defined by the class
In Microsoft System Center Configuration Manager 2007, you perform a synchronous query for Configuration Manager 2007 objects by calling the SWbemServices object ExecQuery method and passing a WQL query.
In Microsoft System Center Configuration Manager 2007, you add context qualifiers to a connection (SWbemServices) or object (SWbemObject) by creating a SWbemNamedValueSet value set to hold the context qualifiers.
You create a Configuration Manager object, in Microsoft System Center Configuration Manager 2007, by calling the SWbemObject object SpawnInstance method.
In Microsoft System Center Configuration Manager 2007, you write to the site control file using Windows Management Instrumentation (WMI) by using the SMS_SiteControlFile class methods.
In Microsoft System Center Configuration Manager 2007, you read an embedded property from a site control file resource by getting the SMS_EmbeddedProperty object for the embedded object from the resources Props property array.
In Microsoft System Center Configuration Manager 2007, you read an embedded property list from a site control file resource by getting the SMS_EmbeddedPropertyList object for the embedded object from the resources PropLists property array.
In Configuration Manager 2007, you read an embedded RegMultiString list from a site control file component or configuration resource by getting the RegMultiStringList SMS_Client_Reg_MultiString_List object from the resources RegMultiStringLists property array.
You write an embedded property to a site control file resource by either updating the property's SMS_EmbeddedObject object if it already exists, or by creating and adding a new SMS_EmbeddedObject object property to the resource's array of properties.
You write an embedded property list to a site control file resource by either updating the property list if it already exists, or by creating and adding a new property list to the resource's list of properties.
You write an embedded RegMultiString list to a site control file component or configuration resource by creating a SMS_Client_Reg_MultiString_List and adding it to the resource's RegMultiStringLists array property.
You create a schedule token by creating and populating an instance of the appropriate SMS_ST_ schedule token class.
When an error occurs in an asynchronous call, the error object is passed as the second parameter to the OnCompleted method. Inside your OnCompleted implementation, you check the error object the same as you would for a synchronous call.
You handle synchronous errors, in Microsoft System Center Configuration Manager 2007, by inspecting the SWbemLastError object when an error occurs. An error has occurred when the error object Number property is non-zero.
To set user security rights for a class of Microsoft System Center Configuration Manager 2007 objects by using the managed SMS Provider, you create and populate a SMS_UserClassPermissions object.
To set user security rights for a Microsoft System Center Configuration Manager 2007 object instance by using the managed SMS Provider, you create an instance of an SMS_UserInstancePermissions object.
You run a SMS_Query based query by getting the query instance and then by running WQL query in the SMS_Query object Expression property.
In Microsoft System Center Configuration Manager 2007, you create an SMS_Query-based query by creating an instance of SMS_Query. The SMS_Query class Expression object defines a WQL query.
The Asset Intelligence catalog can be refreshed manually, outside the normal synchronization schedule. A manual refresh is accomplished by using the RequestCatalogUpdate method on the SMS_AIProxy Server WMI Class.
In Microsoft System Center Configuration Manager 2007, your application uses SMS_Collection Server WMI Class to define the attributes of a collection.
In Microsoft System Center Configuration Manager 2007, your application uses the SMS_Collection Server WMI Class to define the attributes of a collection, such as the membership rules and the refresh schedule
In Microsoft System Center Configuration Manager 2007, the preferred method to enumerate through a collection is to use SMS_FullCollectionMembership Server WMI Class.
In Microsoft System Center Configuration Manager 2007, your application uses the SMS_Collection Server WMI Class to define the attributes of a collection, such as the membership rules and the refresh schedule.
Your application can delete a collection in Microsoft System Center Configuration Manager 2007 by using the SMS_Collection Server WMI Class and class properties.
In Microsoft System Center Configuration Manager 2007, you enable or disable the Desired Configuration Management Client Agent by modifying the site control file settings.
The site control file maintains configuration for the configuration of the site. These code samples query for the specific site control file item Configuration Management Agent, and change the EvaluationSchedule value to set the client agent evaluation schedule.

In Microsoft System Center Configuration Manager 2007, you configure the Heartbeat Discovery settings by modifying the necessary site control file settings.
You configure the Active Directory Security Group Discovery settings, in Microsoft System Center Configuration Manager 2007, by modifying the necessary site control file settings.
You configure the Active Directory System Discovery settings, in Microsoft System Center Configuration Manager 2007, by modifying the necessary site control file settings.
You configure the Network Discovery settings, in Microsoft System Center Configuration Manager 2007, by modifying the necessary site control file settings.
You configure the Active Directory System Group Discovery settings, in Microsoft System Center Configuration Manager 2007, by modifying the necessary site control file settings.
In Microsoft System Center Configuration Manager 2007, you configure the Active Directory User Discovery settings by modifying the necessary site control file settings.
When you discover system resource data for a client, in Microsoft System Center Configuration Manager 2007, you must specify the client's unique identifier value in the data discovery record (DDR).
You enable or disable the Hardware Inventory Client Agent, in Microsoft System Center Configuration Manager 2007, by modifying the site control file settings.
You set the Hardware Inventory Client Agent settings, in Microsoft System Center Configuration Manager 2007, by modifying the necessary site control file settings.
In Microsoft System Center Configuration Manager 2007, you initiate a hardware inventory collection cycle by creating an instance of the CPAppletMgr Client COM Automation Class, identifying the client action, and running the client action by using the PerformAction method.
In Microsoft System Center Configuration Manager 2007, you reset the hardware inventory cache by connecting to the inventory agent namespace and deleting the inventory action status instance for hardware inventory.
You enable or disable the Software Inventory Client Agent, in Microsoft System Center Configuration Manager 2007, by modifying the site control file settings.
You set the Software Inventory Client Agent settings, in Microsoft System Center Configuration Manager 2007, by modifying the necessary site control file settings.
In Microsoft System Center Configuration Manager 2007, you initiate a software inventory collection cycle by creating an instance of the CPAppletMgr Client COM Automation Class, identifying the client action, and running the client action by using the PerformAction method.
In Microsoft System Center Configuration Manager 2007, you reset the software inventory cache by connecting to the inventory agent namespace and deleting the inventory action status instance for software inventory.
You configure the Mobile Device Client Agent settings, in Microsoft System Center Configuration Manager 2007, by modifying the site control file.
In Microsoft System Center Configuration Manager 2007, you add an operating system deployment state migration point folder by adding the folder description to the Directories embedded property list.
In Microsoft System Center Configuration Manager 2007, you configure the operating system deployment state migration point to reject new requests to store user data by setting the SMPQuiesceState embedded property.
In Microsoft System Center Configuration Manager 2007, you configure the state migration point deletion policy by updating the SMPStoreDeletionDelayTimeInMinutes and SMPStoreDeletionCycleTimeInMinutes embedded properties.
In Microsoft System Center Configuration Manager 2007, you set the operating system deployment PXE service point response to incoming PXE requests from unknown computers by setting the SupportUnknownMachines embedded property.
In Microsoft System Center Configuration Manager 2007, you set the operating system deployment PXE service point response to incoming PXE requests by setting the IsActive embedded property.
In Microsoft System Center Configuration Manager 2007, you set the operating system deployment PXE service point response delay by updating ResponseDelay embedded property.
In Microsoft System Center Configuration Manager 2007, you set the operating system deployment PXE service point response to network interfaces by setting the BindPolicy embedded property.
In Microsoft System Center Configuration Manager 2007, you set the operating system deployment to respond to a specific set of network addresses by adding the required media access control (MAC) addresses to the BindExcept embedded property list.
You set the operating system deployment branding information for the Microsoft System Center Configuration Manager 2007 client by changing the OSDBrandingSubtitle property of the client agent component section in the site control file.
You create a Microsoft System Center Configuration Manager 2007 operating system deployment task sequence by creating an instance of the SMS_TaskSequence class.
You create an operating system deployment task sequence, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_TaskSequencePackage class.
You read a task sequence from a task sequence package, in Microsoft System Center Configuration Manager 2007, by calling the SMS_TaskSequencePackage class GetSequence method.
You enumerate the available operating system deployment task sequences, in Microsoft System Center Configuration Manager 2007, by querying the available task sequence packages.
An operating system deployment task sequence action is added to a task sequence by creating an instance of an SMS_TaskSequence_Action derived class and then adding it to the steps of the task sequence.
You delete an operating system deployment task sequence action, in Microsoft System Center Configuration Manager 2007, by removing the action from the task sequence steps.
Conditions can be added to an operating system deployment step (action and group), in Microsoft System Center Configuration Manager 2007, by creating a SMS_TaskSequence_Condition class instance and then associating it with the step.
You enumerate an operating system deployment task sequence, in Microsoft System Center Configuration Manager 2007, by using a recursive method to scan through the task sequence steps and groups.
In Microsoft System Center Configuration Manager 2007, you can reorder the steps (an action or a group) in a task sequence or group by rearranging the step sequence in the Steps property SMS_TaskSequences _Steps array.
An operating system deployment task sequence group, in Microsoft System Center Configuration Manager 2007, can be added to a task sequence by creating an instance of the SMS_TaskSequence_Group class.
You add a step (an action or a group) to an operating system deployment task sequence group, in Microsoft System Center Configuration Manager 2007, by adding the step to the SMS_TaskSequenceGroup.Steps array property.
In Microsoft System Center Configuration Manager 2007, you delete a step (an action or a group) from an operating system deployment task sequence group by deleting the step from the group's list of task sequence steps.
You move a step (an action or a group) from one operating system deployment task sequence group to another, in Microsoft System Center Configuration Manager 2007, by adding the step to the target group and then by deleting the step from the source group.
In Microsoft System Center Configuration Manager 2007, you can create, get, and set task sequence variables in a running task sequence by using the task sequence environment COM automation object (Microsoft.SMS.TSEnvironment).
In Microsoft System Center Configuration Manager 2007, you create an operating system deployment task sequence variable by creating an instance of the SMS_TaskSequence_SetVariableAction class, adding to a task sequence.
In Microsoft System Center Configuration Manager 2007, you create an operating system deployment task sequence variable by creating an instance of the SMS_TaskSequence_SetVariableAction class, adding to a task sequence.
You add a new computer directly to the Microsoft System Center Configuration Manager 2007 database by calling the ImportMachineEntry Method in Class SMS_Site.
You create an association between a reference and destination computer, in Microsoft System Center Configuration Manager 2007, by calling the AddAssociation Method in Class SMS_StateMigration.
You create a collection variable for a Microsoft System Center Configuration Manager 2007 collection by adding instances of SMS_CollectionVariable Server WMI Class to the CollectionVariables property of SMS_CollectionSettings Server WMI Class.
You create a computer variable for a computer that is running Microsoft System Center Configuration Manager 2007 by adding instances of SMS_MachineVariable to the SMS_MachineSettings class MachineVariables array property.
You track Microsoft System Center Configuration Manager 2007 operating system migrations by inspecting the SMS_StateMigration Server WMI Class class.
In Microsoft System Center Configuration Manager 2007 you capture operating system media for use with operating system deployment by using the TsMediaClass Client COM Automation ClassITsMediaClass::CreateCaptureMedia Method method.
In Microsoft System Center Configuration Manager 2007, you create boot media for use with operating system deployment by using the TsMediaClass Client COM Automation ClassITsMediaClass::CreateBootMedia Method method.
In Microsoft System Center Configuration Manager 2007, you create stand-alone operating system media for use with operating system deployment by using the TsMediaClass Client COM Automation ClassITsMediaClass::CreateStandaloneMedia Method method.
In Microsoft System Center Configuration Manager 2007 you serialize a certificate from a PFX file by calling the PxeAuthClass Client COM Automation ClassIPxeAuthClass::ReadIdentity Method method.
In Microsoft System Center Configuration Manager 2007, you create a new self-signed certificate calling the PxeAuthClass Client COM Automation Class class IPxeAuthClass::CreateIdentity Method method.
In Microsoft System Center Configuration Manager 2007, you add an operating system image package by creating an instance of SMS_ImagePackage class.
In Microsoft System Center Configuration Manager 2007, you update the Windows Image (WIM) file that is associated with the operating system package by calling the image package's SMS_ImagePackage class instance ReloadImageProperties method.
In Microsoft System Center Configuration Manager 2007, you view the image properties for the Windows Image (WIM) file that is contained in an operating system package by calling the SMS_ImagePackage class instance GetImageProperties method.
You add a boot image from a Windows Image (WIM) file to Microsoft System Center Configuration Manager 2007 by creating an instance of SMS_BootImagePackage Server WMI Class.
You add an operating system install package to Microsoft System Center Configuration Manager 2007 by creating and populating an instance of SMS_OperatingSystemInstallPackage Server WMI Class.
To clear a PXE advertisement for a Microsoft System Center Configuration Manager 2007 collection, you call the ClearLastNBSAdvForCollection Method in Class SMS_Collection method.
To clear a PXE advertisement for a Microsoft System Center Configuration Manager 2007 resource, you call the SMS_Collection object ClearLastNBSAdvForMachines method.
You can import a Windows driver that is described by an information (.inf) file, in Microsoft System Center Configuration Manager 2007, by using the CreateFromINF Method in Class SMS_Driver.
You can import a Windows driver that is described by a Txtsetup.oem file, in Microsoft System Center Configuration Manager 2007, by using the CreateFromOEM Method in Class SMS_Driver.
You create a package for an operating system deployment driver, in Microsoft System Center Configuration Manager 2007, by creating a SMS_DriverPackage Server WMI Class object.
You add a Windows driver to an operating system deployment boot image package by adding a reference to the required driver in the SMS_BootImagePackage Server WMI ClassReferencedDrivers array property.
You remove a Windows driver from an operating system deployment boot image package by removing it from the ReferencedDrivers property of the SMS_BootImagePackage Server WMI Class object.
You enable or disable a Windows driver in the operating system deployment driver catalog, in Microsoft System Center Configuration Manager 2007, by setting the IsEnabled property of the SMS_Driver Server WMI Class object.
You delete a Windows driver from the operating system deployment driver catalog, in Microsoft System Center Configuration Manager 2007, by deleting its SMS_Driver Server WMI Class object.
You delete an operating system deployment driver package, in Microsoft System Center Configuration Manager 2007, by deleting its SMS_DriverPackage object.
In Microsoft System Center Configuration Manager 2007, you specify the supported platforms of a driver in the SDMPackageXML property XML of the driver's SMS_Driver Server WMI Class object.
In Microsoft System Center Configuration Manager 2007, you add a category to a Windows driver by adding the unique identifier for the category to the SMS_Driver Server WMI ClassCategoryInstance_UniqueIDs array property.
In Microsoft System Center Configuration Manager 2007, you remove a category from a Windows driver by removing the unique identifier for the category from the SMS_Driver Server WMI Class CategoryInstance_UniqueIDs array property.
You can run an action on an out of band computer, in Microsoft System Center Configuration Manager 2007, by using the SMS_Collection class. Two separate methods exist on the SMS_Collection class, one on the instance, and one on the class itself.
You can run an action on an out of band computer, in Microsoft System Center Configuration Manager 2007, by using the SMS_Collection class. Two separate methods exist on the SMS_Collection class, one on the instance, and one on the class itself.
You enable or disable the Remote Tools Client Agent, in Microsoft System Center Configuration Manager 2007, by modifying the site control file settings.
In Microsoft System Center Configuration Manager 2007, you set the Remote Tools Client Agent settings by modifying the necessary site control file settings.
You create a custom report, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_Report class and populating the properties.
You modify a report, in Microsoft System Center Configuration Manager 2007, by loading an existing instance of the SMS_Report class, updating the properties, and saving the report.
You delete a report, in Microsoft System Center Configuration Manager 2007, by getting an existing instance of the SMS_Report class and calling the delete method.
You list dashboards, in Microsoft System Center Configuration Manager 2007, by loading all instances of the SMS_Report class and then enumerating the instances, outputting specific properties as required.
You create a custom dashboard, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_ReportDashboard class and populating the properties.
You modify a dashboard, in Microsoft System Center Configuration Manager 2007, by loading an existing instance of the SMS_ReportDashboard class, updating the properties, and saving the report.
You delete a dashboard, in Microsoft System Center Configuration Manager 2007, by getting an existing instance of the SMS_ReportDashboard class and calling the delete method.
You list dashboards, in Microsoft System Center Configuration Manager 2007, by loading all instances of the SMS_ReportDashboard class and then enumerating the instances and output specific properties as required.
The site control file maintains configuration for the site. This topic shows how to enable or disable the Software Distribution Advertised Programs Client Agent setting in the site control file.
The site control file maintains configuration for the configuration of the site. This topic shows how to configure software distribution advertised programs client agent settings in the site control file.
You set the software distribution branding information for the Microsoft System Center Configuration Manager 2007 client by changing the SWDBrandingSubTitle property of the client agent component section in the site control file.
The following example shows how to create a package in Microsoft System Center Configuration Manager 2007 by using the SMS_Package Server WMI Class class and class properties.
The following example shows how to create a package and program by using a package definition file template in Microsoft System Center Configuration Manager 2007.
The following example shows how to configure the properties of an existing package, in Microsoft System Center Configuration Manager 2007, by using the SMS_Package Server WMI Class class.
The following example shows how to configure an existing package to use binary delta replication, in Microsoft System Center Configuration Manager 2007, by using the SMS_Package Server WMI Class class and the PkgFlags class property.
The following example shows how to delete a package in Microsoft System Center Configuration Manager 2007 by using the SMS_Package Server WMI Class class.
The following example shows how to assign a distribution point to a package by using the SMS_DistributionPoint Server WMI Class and SMS_SystemResourceList Server WMI Class classes in Microsoft System Center Configuration Manager 2007.
The following example shows how to create a program, in Microsoft System Center Configuration Manager 2007, by using the SMS_Program Server WMI Class class and class properties.
The following example shows how to modify a program, in Microsoft System Center Configuration Manager 2007, by using the SMS_Package Server WMI Class and SMS_Program Server WMI Class classes and properties.
The following example shows how to modify a program, in Microsoft System Center Configuration Manager 2007, by using the SMS_Package Server WMI Class and SMS_Program Server WMI Class classes and properties.
In Microsoft System Center Configuration Manager 2007, you can list all programs with their maximum run time values by using the SMS_Package Server WMI Class and SMS_Program Server WMI Class classes and class properties.
Your application can add supported platforms to a package by obtaining specific instances of the SMS_Package Class and SMS_Program Class classes and then adding an instance of the SMS_OS_Details Class class to the SupportedOperatingSystems property.
The following example shows how to create an advertisement by using the SMS_Advertisement Server WMI Class class and class properties in Microsoft System Center Configuration Manager 2007.
The following example shows how to modify an existing advertisement, in Microsoft System Center Configuration Manager 2007, by using the SMS_Advertisement Server WMI Class class and class properties.
Shows how to configure an advertisement to allow reboots outside of a maintenance window by using the SMS_Advertisement Server WMI Class class and the AdvertFlags class property in Microsoft System Center Configuration Manager 2007.
The following example shows how to configure an advertisement to override service windows using the SMS_Advertisement Server WMI Class class and the AdvertFlags class property in Microsoft System Center Configuration Manager 2007.
You can assign an advertisement to a collection by using the SMS_Advertisement Server WMI Class class in Microsoft System Center Configuration Manager 2007.
The following example shows how to assign a distribution point to a package by using the SMS_DistributionPoint Server WMI Class class and class properties in Microsoft System Center Configuration Manager 2007.
The following example shows how to set the distribute on demand flag property of an existing package by using the SMS_Package Server WMI Class class in Microsoft System Center Configuration Manager 2007.
To initiate a content maintenance cycle on a branch distribution point in Microsoft System Center Configuration Manager 2007, your application can use the CPAppletMgr Client COM Automation Class.
Your application can create a Microsoft System Center Configuration Manager 2007 maintenance window by using the SMS_CollectionSettings Server WMI Class and SMS_ServiceWindow Server WMI Class classes and properties.
You can change maintenance window properties for a collection, in Microsoft System Center Configuration Manager 2007, by using the SMS_CollectionSettings Server WMI Class and SMS_ServiceWindow Server WMI Class classes and properties.
You can delete maintenance window, in Microsoft System Center Configuration Manager 2007, by using the SMS_CollectionSettings Server WMI Class and SMS_ServiceWindow Server WMI Class classes and properties.
The following example shows how to list the maintenance windows for a specific collection by using the SMS_CollectionSettings Server WMI Class class.
You can configure an existing mandatory advertisement for Wake On LAN by using the SMS_Advertisement class and properties.
You configure Automatic Software Metering Rule Generation settings, in Microsoft System Center Configuration Manager 2007, by modifying the site control file.
You create a software metering rule, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_MeteredProductRule class and populating the properties.
You delete a software metering rule, in Microsoft System Center Configuration Manager 2007, by loading the instance of the software metering rule that is identified by the software metering rule ID and calling the delete method.
You enable or disable a software metering rule, in Microsoft System Center Configuration Manager 2007, by loading the instance of the software metering rule that is identified by the software metering rule ID and then setting the Enabled value.
You initiate a software metering usage report cycle by creating an instance of the CPAppletMgr Client COM Automation Class and running the Software Metering Usage Report Cycle action by using the PerformAction method.
You view file usage summary information, in Microsoft System Center Configuration Manager 2007, by using the SMS_MeteredFiles and SMS_FileUsageSummary classes.
You view monthly usage summary information, in Microsoft System Center Configuration Manager 2007, by using the SMS_MeteredFiles, SMS_MonthlyUsageSummary, SMS_MeteredUser and SMS_R_System classes.
You can determine the overall health or status of a site, in Microsoft System Center Configuration Manager 2007, by inspecting the SMS_SummarizerSiteStatus object Status property.
In Microsoft System Center Configuration Manager 2007, you can read the available tally intervals for a site by inspecting the site control file SMS_COMPONENT_STATUS_SUMMARIZER object Summary_Intervals embedded property list.
In Microsoft System Center Configuration Manager 2007, you can read user-defined status messages, on the site server, by querying the SMS Provider.
You can report user-defined informational, warning, and error status messages, on the site server, by using the methods that are defined in the SMS_StatusMessage class.
In Microsoft System Center Configuration Manager 2007, you delete status messages by calling the SMS_StatusMessage class DeleteByID method and supplying an array of status message RecordID identifiers.
You can use the package summarizer classes to determine whether a package has been distributed and is ready to be advertised.
You configure the software update point, in Microsoft System Center Configuration Manager 2007, by modifying the site control file settings.
You configure the Windows Server Update Services (WSUS) component settings, in Microsoft System Center Configuration Manager 2007, by modifying the site control file.
You enable or disable the Software Updates Client Agent, in Microsoft System Center Configuration Manager 2007, by modifying the site control file settings.
You synchronize the software update point, in Microsoft System Center Configuration Manager 2007, by modifying the Sync Now property in the site control file.
You configure software updates to override maintenance windows, in Microsoft System Center Configuration Manager 2007, by updating the OverrideServiceWindows property of an assignment (deployment).
You configure software updates deployment properties that are required for interoperability with SMS 2003 by modifying the properties of an instance of the SMS_UpdatesAssignment Server WMI Class.
You enumerate the software updates by creating an instance of the CCMUpdatesDeployment COM class and by using the EnumerateUpdates method. This example enumerates all updates that are deployed and available in the client UI.
You install software updates, in Microsoft System Center Configuration Manager 2007, by creating an instance of the CCMUpdatesDeployment COM class and using the InstallUpdates method.
You set the silent mode on a client, in Microsoft System Center Configuration Manager 2007, by creating an instance of the CCMUpdatesDeployment COM Automation Class and by using the SetUserExperienceFlag method.
You set the local software updates schedule, in Microsoft System Center Configuration Manager 2007, by creating an instance of the CCMUpdatesDeployment COM Automation Class and by using the SetUserDefinedSchedule method.
You initiate a software updates evaluation cycle, in Microsoft System Center Configuration Manager 2007, by creating an instance of the CPAppletMgr Client COM Automation Class, identifying the client action, and running the client action by using the PerformAction method.
You initiate a software updates scan cycle, in Microsoft System Center Configuration Manager 2007, by creating an instance of the CPAppletMgr Client COM Automation Class, identifying the client action, and running the client action by using the PerformAction method.
In Microsoft System Center Configuration Manager 2007, you refresh the client compliance state by creating an instance of the UpdatesStore COM class and by using the RefreshServerComplianceState method.
This topic explains how to enumerate software updates that match specific criteria in Microsoft System Center Configuration Manager 2007 by building a query and then using the ExecuteQuery method of the QueryProcessor class to run the query.
You create an update list that contains a set of software updates, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_AuthorizationList class and populating the properties.
You create a software updates deployment template, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_Template class and populating the properties.
You create a software updates deployment package, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_SoftwareUpdatesPackage class and populating the properties.
You create a software updates deployment, in Microsoft System Center Configuration Manager 2007, by creating an instance of the SMS_UpdatesAssignment Server WMI Class and populating the properties.
You change the deployment package source for a software updates deployment package by obtaining an instance of the SMS_SoftwareUpdatesPackage class and by using the ValidateNewPackageSource method.
The following script backs up the System Center Virtual Machine Manager (VMM) database to a local drive. You can back up the database to a network share by substituting the Universal Naming Convention (UNC) path for the drive path in the script.
You can verify whether the computer is pending a reboot by looking for the RebootPending registry key. The script in this topic looks for that key and, if the key is present, will restart the computer upon confirmation.
When a System Center Virtual Machine Manager (VMM) job completes, an audit record is saved that lists the changes that the job made to the VMM object. To access the audit record information for a job, get the job by using the Get-Job cmdlet with the Full parameter.
The following script uses a self-signed certificate to sign all of the scripts stored in the VMM Library. Before you run the script, you need to create a self-signed certificate.
The following script adds two Windows Server-based hosts in a trusted Active Directory Domain to System Center Virtual Machine Manager (VMM). You can add more than two hosts by including additional host computer names in the $VMHosts variable.
In System Center Virtual Machine Manager (VMM) 2008 R2, you can start maintenance mode for a Windows-based host anytime you need to perform maintenance tasks (such as applying updates or replacing a physical component) on the host.
The script uses the Update-VMMManagedComputer cmdlet to asynchronously update the agent software so that all the managed computers can be updated simultaneously. The script filters out types of hosts that you will need to manually update, such as perimeter network hosts.
The following example converts a virtual machine that is deployed on an ESX Server host to a Hyper-V virtual machine on a VMM host. To copy the entire script, see ConvertESXVMUsingV2VfromHost.ps1.
The following example converts a VMware Server-based virtual machine that is stored in the library to a Hyper-V virtual machine on a VMM host. To copy the entire script, see ConvertESXVMUsingV2VfromLibrary.ps1.
Use the Set-VM VMM cmdlet with the InstallVirtualizationGuestServices parameter to install virtualization guest services on the virtual machines that are managed by the VMM server.
The following script gets the host ratings for all of the hosts in a host group. performs a direct validation of the specified virtual machine against each host in the host group that had an original host rating greater than zero and returns the host ratings for each host.
The following script connects the virtual network adapter to a virtual network, changes the MAC address from static to dynamic, and enables virtual LAN (VLAN) identification for the network adapter.
You can use the following script to create multiple virtual machines when you do not have an existing template.
The following script creates a specified number of virtual machines from a template and then deploys them on the highest-rated hosts in a host group.
The following script creates a virtual machine in the library from a blank virtual hard disk. Then, the script deploys the virtual machine on the best-rated host in the host group. Finally, the script stops the virtual machine and stores it in the library.
The following script gets the computer name and IP address for each virtual machine that is managed by VMM and is in DNS.
The following script checks all the virtual machines that are managed by the System Center Virtual Machine Manager (VMM) server to determine whether virtual guest services are installed.
To quickly create virtual machines from a template, you can use the UseLocalVirtualHardDisks parameter of the New-VM cmdlet.
You can use this script to create a virtual machine from a template that contains an embedded answer file and Integration Components.
You can use rapid provisioning to recover a virtual machine after a Hyper-V host fails and cannot be recovered.
You can use parameters with the Set-VM cmdlet to match the CPU settings for a virtual machine to the actual processor hardware on a host during placement or migration.
The following script adds a host cluster and creates an HAVM. Then the script migrates the HAVM to the highest rated host, stops the HAVM to increase its memory, and then restarts the HAVM. The HAVM is then deleted, and the host cluster is removed from VMM.
The following script adds a host cluster to System Center Virtual Machine Manager (VMM).
Uses quick migration to move all running virtual machines off a host in a cluster, and then removes the host from service. The script then returns the host to service and performs the same tasks on the other hosts in the cluster.
The following script is the complete script for adding a VMware ESX Server host and changing its status from OK (Limited) to OK.
The following script adds a VMware VirtualCenter Server to System Center Virtual Machine Manager (VMM) in secure mode.
Adds a VMware VirtualCenter Server to VMM in secure mode and changes the status of the ESX Server hosts from OK (Limited) to OK.