SMSUG.ca

...your virtual communITy
Welcome to SMSUG.ca Sign in | Join | Help
in Search

Garth Jones

How to create a batch file using SQL

The output of this query can be used to create a batch file to execute service control to fix BITS service.

  • Open  SQL  Server Management Studio and paste this query.
  • Edit it as you need.
  • Execute the query
  • Save the result panel as fixbits.bat
  • Finally open a DOS Prompt
  • Make sure that sc.exe is located within the path.
  • Run fixbits.bat

 

 

select

'sc \\'+CS.Name0 +' sdset bits "bla bla"'

from

      dbo.v_GS_SERVICE S left outer join dbo.v_GS_Computer_system cs on CS.ResourceID = S.ResourceID

where

      (displayname0 = 'Background Intelligent Transfer Service') and

      ( State0 != 'Running' or isnull(State0, 'NULL') = 'NULL')

 

Published Jan 22 2009, 12:27 PM by Garth
Filed under: , , ,

Comments

No Comments

This Blog

Syndication

News

Training

Powered by Community Server (Non-Commercial Edition), by Telligent Systems