CreateWindowsDesktop

Creates a Windows Desktop access right.

Syntax

IWindowsDesktop CreateWindowsDesktop () 

Return value

A Windows desktop access right for the zone.

Discussion

A Windows desktop right provides a complete desktop that behaves as if the user had logged in as specific privileged user. For example, if you have an SQL Administrator login, you can give an ordinary user an SQL Administrator desktop so they can operate in that role when necessary.

The right is not stored in Active Directory until you call the Commitmethod.

Example

The following code sample illustrates using the CreateWindowsDesktop method 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.");
}
else
{
    IWindowsDesktop objWindowsDesktop = objZone.GetWindowsDesktop(strName);
    if (objWindowsDesktop != null)
    {
        Console.WriteLine("WindowsDesktop " + strName + " already exists.");
    }
    else
    {
        objWindowsDesktop = objZone.CreateWindowsDesktop();
        objWindowsDesktop.Name = strName;
        objWindowsDesktop.RunAsType = WindowsRunAsType.Self;
        objWindowsDesktop.Priority = 0;
        objWindowsDesktop.Description = "optional description";
        objWindowsDesktop.Commit();
        Console.WriteLine("Windows Desktop " + strName + " has been created 
            successfully.");
    }
}
...