Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
I'm probably missing something because I can create the VS object but when I try to do something with it I got an "OLE Exception".
objVS= CreateObject("VirtualServer.Application") name= objVS.NameWhen I use a method instead of a property and don't supply any parameters it says "bad parameter count", so I seam to have 'contact' with the object.
any idea what I'm doing wrong or should do to find out what the problem is?
(I've got local administrator permissions on the server)
If I remember correct, I was able to get access to Virtual Server object properties and methods by fiddling with the Component Services administrative tool. What I changed I don't recall.
Sorry I can't be of more help.
________ VB code __________ The following steps must be performed to set up the build environment: Create a new Windows Applications project called ShowVSVersion. Form1 is created by default. Add a module to the project. Module1 is created by default. Add the reference to the Virtual Server 2005 Type Library From the Project menu, choose Properties and define Sub Main as the start-up procedure. Enter the following sample code into Module1: Imports System.Reflection Imports System.Runtime.InteropServices Imports Microsoft.VirtualServer.Interop Public Class InitVS ' Create a SUB with PreserveSig:=FALSE so the COM InterOp layer will ' perform the error checking and throw an exception, instead of using ' a Function and returning an HRESULT. PreserveSig:=False, _ ExactSpelling:=True, _ EntryPoint:="CoInitializeSecurity", _ CallingConvention:=CallingConvention.StdCall, _ SetlastError:=False)> _ Private Shared Sub CoInitializeSecurity( _ ByVal pSD As IntPtr, _ ByVal cAuthSvc As Int32, _ ByVal asAuthSvc As IntPtr, _ ByVal pReserved1 As IntPtr, _ ByVal dwAuthnlevel As UInt32, _ ByVal dwImpLevel As UInt32, _ ByVal pAuthInfo As IntPtr, _ ByVal dwCapabilities As UInt32, _ ByVal pvReserved2 As IntPtr) End Sub Private Const RPC_C_AUTHN_LEVEL_PKT_PRIVACY As Long = 6 Private Const RPC_C_IMP_LEVEL_IMPERSONATE As Long = 3 Private Const EOAC_DYNAMIC_CLOAKING As Long = 64 ' Call CoInitializeSecurity with dwImpLevel set to Impersonate. Required by ' the Virtual Server COM Interface Public Sub New() CoInitializeSecurity(System.IntPtr.Zero, _ -1, _ System.IntPtr.Zero, _ System.IntPtr.Zero, _ Convert.ToUInt32(RPC_C_AUTHN_LEVEL_PKT_PRIVACY), _ Convert.ToUInt32(RPC_C_IMP_LEVEL_IMPERSONATE), _ System.IntPtr.Zero, _ Convert.ToUInt32(EOAC_CLOAKING), _ System.IntPtr.Zero) End Sub 'Get VMVirtualServerClass instance from local server using COM Public Function GetVMVirtualServerClass() As VMVirtualServerClass GetVMVirtualServerClass = New VMVirtualServerClass End Function End Class Module Module1 _ Sub Main() ' Initialize COM with Impersonate first Dim myApp As InitVS myApp = New InitVS ' Connect locally Dim myVS As VMVirtualServer myVS = myApp.GetVMVirtualServerClass() ' Display VS version info name= myVS.Name End Sub End Module
With Windows there is almost always more than one answer and very seldom just "the answer". But if demand is sufficient, the alternative COM initialization may be provided as a user option in some future version of WB.
Here is an MSFT article that discusses using the DCOMCNFG utility to set security
http://msdn.microsoft.com/library/en-us/dncomg/html/msdn_practicom.asp
Article ID: W17100
File Created: 2007:07:03:14:28:18
Last Updated: 2007:07:03:14:28:18