Re: Check if a service is installed

From: Brian Vallelunga (bgvallelunga_at_starpower.net)
Date: 08/18/04


Date: Tue, 17 Aug 2004 22:55:47 -0400

That definitely helps in figuring out how to run the command to install or
uninstall the service, thanks. Just identifying a file though is
insufficient for determining if a service exists. I'll keep looking. At
least part of the problem is solved.

Brian

"Kody Brown" <kody@noway.com> wrote in message
news:%23GC$MqKhEHA.1724@tk2msftngp13.phx.gbl...
> Maybe this will help?
>
> I have run into this before with registered DLL's. I check if the file
> exists, then call "regsvr32 /u dllname" using the WScript.Shell object.
> Once, it was unregistered, I would copy the newer file and register and/or
> start it..
>
> Dim filename : filename = "C:\Program Files\MyDir\myfile.dll"
> Dim sourcefile : sourcefile = "D:\source\myfile.dll"
> Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
> Dim objShell : Set objShell = WScript.CreateObject("WScript.Shell")
>
> If objFSO.FileExists(filename) Then
> objShell.Run "regsvr32.exe /U " & filename
> objFSO.CopyFile sourcefile, filename
> End If
>
> objShell.Run "regsvr32.exe " & filename
>
>
> You can control some services through the NET command, also...
>
> objShell.Run "net " & servicename & " stop"
> objShell.Run "net " & servicename & " start"
>
>
> This is from memory, hopefully, it is accurate!
>
> --
> -Kody
> kody at weekendtech dot net
> "Custom ASP.Net Web Controls"
>
>
>
> "Brian Vallelunga" <bgvallelunga@starpower.net> wrote in message
> news:O9$T43HhEHA.1644@tk2msftngp13.phx.gbl...
>> I'm totally new to scripting and I want to create a very simple script
> that
>> does the following:
>>
>> 1) Checks if a service is installed.
>> 2) Uninstalls the service if it is.
>> 3) Installs a new instance of the service.
>> 4) Starts the service.
>>
>>
>> I'm reading up, but don't have a clue where to start. Installing and
>> uninstalling the service are very simple tasks using just the command
>> line
>> "installutil" program. I'm not even sure how to go about calling this.
>>
>> Pointers to resources and / or code would be greatly appreciated.
>>
>> Thanks,
>>
>> Brian
>>
>>
>
>



Relevant Pages

  • Re: Office 2007 Deployment
    ... Other than the SMS restarts it's identical I ... first time start up issues if the computer reboots after install) ... attempt at the command line from SCCM didn't. ... What if you manually uninstall Office 2003 then try running SMS ...
    (microsoft.public.sms.admin)
  • Re: Windows error message
    ... > MS-DOS andMicrosoft Windows applications. ... Error message when you install or start an MS-DOS or 16-bit ... In the command prompt, type in the following two commands exactly as ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.general)
  • Re: KB835732 Setup Error
    ... run the following command in a command prompt(run e.g. ... Copyright 1985-2001 Microsoft Corp. ... >> I am trying to install this security update on some obscure computers at work ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsxp.security_admin)
  • Re: 16 Bit Programme
    ... I HAVE IN THE PAST RUN THIS PROGRAMME ON MY ... Error message when you install or start an MS-DOS or 16-bit ... In the command prompt, type in the following two commands exactly as ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsxp.general)
  • Re: Urget! MS04-009
    ... The command line switches still prompt for a directory to extract to. ... and install it using msiexec.exe as ... Applying Full-File Updates to Client Computers ... Microsoft MVP Scripting and WMI, ...
    (microsoft.public.sms.swdist)