You can do this easily using the COM+ Admin dll. It can be done in
VB or in a script language like VBS (which you can run using WSH). Here's example code:
Code:
On Error Resume Next
' if VB add a reference to COM+ 1.0 Admin Type Library.
' if VBS just declare this object without a type
Dim oCatalog As COMAdmin.COMAdminCatalog
Dim sName As String
Set oCatalog = CreateObject("COMAdmin.COMAdminCatalog")
sName = "the package name goes here"
oCatalog.ShutdownApplication sName
' to start the app use this syntax
'oCatalog.StartApplication sName
If Err.Number = 0 Then
MsgBox sName & " has been shut down.", vbOKOnly + vbInformation
Else
Const cMsg = "Error 0x#ERR# trying to shut down #APP#. (#DESC#.)"
Dim sMsg
sMsg = Replace(cMsg, "#ERR#", Hex(Err.Number), 1, 1)
sMsg = Replace(sMsg, "#APP#", sName, 1, 1)
sMsg = Replace(sMsg, "#DESC#", Err.Description, 1, 1)
MsgBox sMsg, vbOKOnly + vbInformation
Err.Clear
End If
Set oCatalog = Nothing
hth
Phil