共用方式為


IVMSecurity interface

The IVMSecurity interface manipulates the access rights of an object in Virtual Server.

Members

The IVMSecurity interface inherits from the IDispatch interface. IVMSecurity also has these types of members:

Methods

The IVMSecurity interface has these methods.

Method Description
_ToSecurityDescriptor Creates a self-relative SECURITY_DESCRIPTOR structure representing the current state of the IVMSecurity instance.
AddEntry Adds a new access control entry.
FindEntry Finds an existing access control entry.
RemoveEntry Removes an access control entry.

Properties

The IVMSecurity interface has these properties.

Property Access type Description
AccessRights
Read-only
Contains a representation of the discretionary access control list.
CurrentUserAccessRights
Read-only
The access rights for the caller of the COM interface.
GroupName
Read/write
The account name of the group.
GroupSid
Read/write
The SID string of the group.
OwnerName
Read/write
The account name of the owner.
OwnerSid
Read/write
The SID string of the owner.

Examples

The following example shows how to create and use an IVMSecurity object from VBScript:

Dim vsApp
    Set vsApp = WScript.CreateObject("VirtualServer.Application")

    Dim vsSecurity
    Set vsSecurity = WScript.CreateObject("VirtualServer.VMSecurity")

    Rem By default, the newly created VMSecurity object will have
    Rem the service account as the owner. Since this is normally 
    Rem the NetworkService account, we'll need to change the owner.

    vsSecurity.OwnerName = "Administrators"

    Rem Allow users to view and start virtual machines, but only
    Rem computer Administrators can configure them.

    Dim ace
    Set ace = vsSecurity.AddEntry("Administrators",vmAccessRights_Allowed)
    ace.WriteAccess = True
    ace.ReadAccess = True
    ace.ExecuteAccess = True
    ace.DeleteAccess = True
    ace.ReadPermissions = True
    ace.ChangePermissions = True

    Set ace = vsSecurity.AddEntry("Everyone",vmAccessRights_Allowed)
    ace.ReadAccess = True
    ace.ExecuteAccess = True
    ace.ReadPermissions = True

    Rem The service account also needs access.

    Set ace = vsSecurity.AddEntry("NT AUTHORITY\NetworkService",vmAccessRightsAllowed)
    ace.WriteAccess = True
    ace.ReadAccess = True
    ace.ExecuteAccess = True
    ace.DeleteAccess = True
    ace.ReadPermissions = True
    ace.ChangePermissions = True

    vsApp.Security = vsSecurity

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IDispatch