RUN NET START/STOP MSSQLSERVER FROM SSIS PACKAGE
HELLO, I want to create a package which start and stop the SQL server's services... i know i can achive this via NET COMMAND.... but i coudnt findin which task (SSIS)I can place that command?.. I also came across thatI can achieve thisusing Execute Process task but for this I have to define executable file.... actually i dont want ne thing outside from my SSIS package CAN I ACHIEVE THIS WITH IN SSIS PACKAGE? is there ne other alternative? regards, Anas
March 27th, 2007 1:34pm

Execute "cmd.exe" and use the following arguments:"/C net send ..."Try running from the command line to see what I'm talking about.cmd.exe /C net send ...
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2007 3:59pm

Phil Brammer wrote: Execute "cmd.exe" and use the following arguments:"/C net send ..."Try running from the command line to see what I'm talking about.cmd.exe /C net send ... what do u mean by that? where shud i run that command? can u please explain it in more details... regards, Anas
March 27th, 2007 4:12pm

In the execute process task. The executable is "cmd.exe" and the arguments are "/C net start..."
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2007 4:15pm

You can start and stop services using the WMI connection manager. The WMI connection manager's acquires a ManagementScope. Other connection manager's acquire SqlConnections, MessageQueues, and so on.Add a WMI connection manager, named "WMI" with the following connection string, built dynamically as the case may be.ServerName=\\localhost;Namespace=\root\cimv2:Win32_Service.Name="MSSQLSERVER";UseNtAuth=True;UserName=;Use the connection manager in a task (custom or script) to invoke any management call (including service management). I left out handling of dependent services here (for example, SQL Agent is a dependent service), but this may suffice for the general concept. Imports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Runtime Imports System.Management ' Add reference to System.Management.dll Public Class ScriptMain Private wmiScope As ManagementScope Private svc As ManagementObject Public Sub Main() Dts.TaskResult = Dts.Results.Success Try wmiScope = DirectCast(Dts.Connections("WMI").AcquireConnection(Nothing), _ ManagementScope) wmiScope.Connect() svc = New ManagementObject(wmiScope, wmiScope.Path, Nothing) If CType(svc("State"), String) = "Running" Then svc.InvokeMethod("StopService", Nothing) End If Catch ex As Exception Dts.Events.FireError(1, ex.TargetSite.ToString(), ex.Message, _ String.Empty, 0) Dts.TaskResult = Dts.Results.Failure End Try End Sub End Class
March 28th, 2007 1:44pm

jaegd wrote: You can start and stop services using the WMI connection manager. The WMI connection manager's acquires a ManagementScope. Other connection manager's acquire SqlConnections, MessageQueues, and so on.Add a WMI connection manager, named "WMI" with the following connection string, built dynamically as the case may be.ServerName=\\localhost;Namespace=\root\cimv2:Win32_Service.Name="MSSQLSERVER";UseNtAuth=True;UserName=;Use the connection manager in a task (custom or script) to invoke any management call (including service management). I left out handling of dependent services here (for example, SQL Agent is a dependent service), but this may suffice for the general concept. Imports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Runtime Imports System.Management ' Add reference to System.Management.dll Public Class ScriptMain Private wmiScope As ManagementScope Private svc As ManagementObject Public Sub Main() Dts.TaskResult = Dts.Results.Success Try wmiScope = DirectCast(Dts.Connections("WMI").AcquireConnection(Nothing), _ ManagementScope) wmiScope.Connect() svc = New ManagementObject(wmiScope, wmiScope.Path, Nothing) If CType(svc("State"), String) = "Running" Then svc.InvokeMethod("StopService", Nothing) End If Catch ex As Exception Dts.Events.FireError(1, ex.TargetSite.ToString(), ex.Message, _ String.Empty, 0) Dts.TaskResult = Dts.Results.Failure End Try End Sub End Class what do you means by "' Add reference to System.Management.dll"... actually i geting error on ManagementScope ((blue under line) can u please tell me ? thanx for ur support regards, Anas
Free Windows Admin Tool Kit Click here and download it now
March 28th, 2007 3:46pm

There are about4 ways to add an assemblyreference in a given script task. There may be others for all I know. 1. Project Menu/Addreference ... to System.Management.dll 2.View menu/Project explorer. Right click(get context menu)on the project explorer References node. Chose assembly... 3. View menu/Object Browser. Browse to System.Management assembly. Click on the "+" toolbar strip icon. 4. View menu/Class view. Right click (get context menu) on References node. Choose assembly...
March 29th, 2007 11:25am

Thanks, I've just realized I can write the service name ..
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2011 6:17am

Is it relate to all SQL's services ?? How can I stop only the Analysis service ??
June 22nd, 2011 6:47am

Is it relate to all SQL's services ?? How can I stop only the Analysis service ?? You can stop/start all windows services (except ssis :-) http://microsoft-ssis.blogspot.com/2010/12/start-and-stop-batchfile-services-via.htmlPlease mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2011 7:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics