Let me see if I can break this out, below is the function in .net that I call but the variables are very generic so I recyle this code without it being ghost specific:
Code:
Function ProcessCreate(ByVal Server, ByVal cmd) Dim process, processid, nRet If Server = "" Then process = GetObject("WinMgmts:{impersonationLevel=impersonate}!/root/cimv2:Win32_Process") Else process = GetObject("WinMgmts:{impersonationLevel=impersonate}!//" & Server & "/root/cimv2:Win32_Process") End If nRet = process.Create(cmd, System.DBNull.Value, System.DBNull.Value, processid) If (nRet <> 0) Then MsgBox("Failed To Create Remote GhostCast Session " & Session.Text & " Process on Server " & Server, MsgBoxStyle.Critical, "GhostSrv Create Failed") End End If ProcessCreate = processid process = Nothing End Function
Now that I look at the code its not .net specific, you could use this in VB6 or put it in a converter to make it vb script Im sure. Anyway, let me see if I can derive my ghostcast server command line for you:
When I call the function this is what I do:
Code:
ProcessCreate(ServName.Text, ServerPath & "ghostsrv.exe " & ImagePath.Text & " " & Session.Text & " " & Switches.Text)
The first entry is the server I want to remote spawn on, the second is the command line which would look something like this:
\\server\c$\ghost\ghostsrv.exe \\server\c$\ghost\image.gho ghostsessionname + whatever switches
Darn Smileys! The smiley should be close Parenthesis
Message Edited by David.Poprik on 05-01-200701:52 PM
Oh and FYI this impersonates the user running it, I would have to look up supplying credentials. This is about 3 years old, I use real .net WMI code these days not vb script code.
Message Edited by David.Poprik on 05-01-200701:57 PM