AddWindowsDesktop
Adds a Windows desktop right to the role.
Syntax
void AddWindowsDesktop(IWindowsDesktop windowsDesktop)
Parameter
Specify the following parameter when using this method:
Parameter | Description |
---|---|
windowsDesktop
|
The Windows desktop right you want to add to the role. |
Discussion
This right is not stored in Active Directory until you call the Commit
method.
Exceptions
AddWindowsDesktop
throws an ApplicationException
if the Windows desktop right is
not in the current or parent zone.
Example
The following code sample illustrates using AddWindowsDesktop
in a script:
...
// Get the zone object
IHierarchicalZone objZone =
cims.GetZoneByPath("cn=" + strZone + "," + strContainerDN) as IHierarchicalZone;
if (objZone == null)
{
Console.WriteLine("Zone " + strZone + " does not exist.");
return;
}
IRole objRole = objZone.GetRole(strRole);
if (objRole == null)
{
Console.WriteLine("Role " + strRole + " does not exist.");
return;
}
IWindowsDesktop objWindowsDesktop =
objZone.GetWindowsDesktop(strWindowsDesktop);
if (objWindowsDesktop == null)
{
Console.WriteLine("WindowsDesktop " + strWindowsDesktop + " does not exist.");
return;
}
objRole.AddWindowsDesktop(objWindowsDesktop);
objRole.Commit();
...