This method creates a new device imaging deployment.
Syntax
public static void CreateInstance( string CollectionID, string DeploymentComment, string DeploymentName, DateTime StartTime, bool StartTimeEnabled, bool StartTimeIsGMT, DateTime ExpirationTime, bool ExpirationTimeEnabled, bool ExpirationTimeIsGMT, bool IncludeSubCollection, string OEMPluginID, string ImageFileLocation, string RemoteServerName, string DeploymentID ); |
Parameters
- CollectionID
-
[in] Identifier of the collection of devices.
- DeploymentComment
-
[in] Comment that describes the deployment.
- DeploymentName
-
[in] Name of the deployment.
- StartTime
-
[in] Date and time when the deployment starts.
- StartTimeEnabled
-
[in] Trueif the deployment is scheduled to start at the value specified in StartTime. Falseif the deployment starts immediately after it is created.
- StartTimeIsGMT
-
[in] Trueif StartTimeis in Coordinated Universal Time (Greenwich Mean Time); Falseotherwise.
- ExpirationTime
-
[in] Date and time when the deployment expires.
- ExpirationTimeEnabled
-
[in] Trueif an image deployment expiration time is set. Falseif the image deployment time is not set.
- ExpirationTimeIsGMT
-
[in] Trueif ExpirationTimeis in Coordinated Universal Time (Greenwich Mean Time); Falseotherwise.
- IncludeSubCollection
-
[in] Trueif an image deployment includes a sub-collection. Falseotherwise.
- OEMPluginID
-
[in] Identifier of the device imaging component.
- ImageFileLocation
-
[in] File location of the deployment.
- RemoteServerName
-
[in] Name of the deployment remote server.
- DeploymentID
-
[out] Identifier of the device imaging deployment that is created.
Return Value
None
Remarks
The device imaging deployment that is created by this method will start at the time specified in the StartTimeparameter and will expire at the time specified in the ExpirationTimeparameter.
Note: |
---|
This method is asynchronous. A successful return from this method does not indicate that the device imaging deployment is created. |
Example
The following code example creates and begins a new image deployment. For information about calling the code example, see Calling WMI Providers Code Examples.
Copy Code | |
---|---|
public void CreateAndBeginDeployment(ManagementScope scope) { using (ManagementClass classInstance = new ManagementClass(scope, new ManagementPath("root\\EDM:EDM_ImageDeployment"), new ObjectGetOptions())) { // Create an instance of EDM_ImageDeploymentPlugin ManagementBaseObject inParams = classInstance.GetMethodParameters("CreateInstance"); // Add the input parameters inParams["DeploymentName"] = "SDK Sample Deployment"; inParams["DeploymentComment"] = "This is sample deployment"; // OEMPluginID - use the appropriate ID for the installed device imaging component inParams["OEMPluginID"] ="aac3fa7d-ad4e-4f39-8bfc-1ca088886215"; // CollectionID for “All Systems” inParams["CollectionID"] = "SMS00001"; inParams["IncludeSubCollection"] = true; inParams["ImageFileLocation"] = "C:\\newimage.img"; inParams["RemoteServerName"] = string.Empty; // Call the CreateInstance method of EDM_ImageDeploymentPlugin ManagementBaseObject outParams = classInstance.InvokeMethod("CreateInstance", inParams, null); string deploymentID = (string)outParams["DeploymentID"]; //Use the returned DeploymentID to start the deployment inParams = classInstance.GetMethodParameters("BeginImageDeployment"); inParams["DeploymentID"] = deploymentID; // Wait before calling the BeginImageDeployment method // The delay depends on the size of targeted collection System.Threading.Thread.Sleep(2000); // Start the device imaging deployment classInstance.InvokeMethod("BeginImageDeployment", inParams, null); } } |