CreateWindowsApplication
Creates a Windows application access right.
Syntax
IWindowsApplication CreateWindowsApplication ()
Return value
A Windows application access right for the zone.
Discussion
A Windows application right gives a user the ability to access the authorized Windows application.
The right is not stored in Active Directory until you call the Commit
method.
Example
The following code sample illustrates using the CreateWindowsApplication
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
{
IWindowsApplication objWindowsApplication =
objZone.GetWindowsApplication(strName);
if (objWindowsApplication != null)
{
Console.WriteLine("WindowsApplication " + strName + " already exists.");
}
else
{
objWindowsApplication = objZone.CreateWindowsApplication();
objWindowsApplication.Name = strName;
objWindowsApplication.RunAsType = WindowsRunAsType.Self;
objWindowsApplication.Priority = 0;
objWindowsApplication.Description = "optional description";
objWindowsApplication.Command = strApplication;
objWindowsApplication.Commit();
Console.WriteLine("Windows Application " + strName + " has been created
successfully.");
}
}
...