Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Stop a service on all machines in a file.

Hi,

I have a service called devicelock running on all machines in the network.

I want to stop and disable and another script to stop and remove the service.

Regards
Sharath
Avatar of merowinger
merowinger
Flag of Germany image

To disable a service on all or on specified PCs in a domain,
the best is to make a Group Policy!
Make the following on your Domain Controller:
Start->Programs->Administrative Tools->Default Domain Security Policy

In the Console:
Security Settings->System Services->Choose the specified Service->Disable
Note this will affect all PC's

For specified PC's make the following:
Start->run->mmc->Add/Remove Snap-in->Security Templates->Make a new Template->
Configure the specified service->Save the tempate on the Systemdrive

Open the Group Policy u want use -> Computer Configuration->Windows Settings->Rightclick Security Settings->Import Policy->Then choose the file u have created!
Avatar of bsharath

ASKER

For say 100 Machines how do i do this.
specified machines? pcs in one specified ou? then make this:
Start->run->mmc->Add/Remove Snap-in->Security Templates->Make a new Template->
Configure the specified service->Save the tempate on the Systemdrive

Create a Group Policy for the ou -> Computer Configuration->Windows Settings->Rightclick Security Settings->Import Policy->Then choose the file u have created!
Avatar of Admin4XP
Admin4XP

Make a txt file called Clients.txt on C:\ input all the PCs you want to stop the service om=n.
Make a batch file and input the following:

for /f %%a in (C:\Cients.txt) do sc \\%%a stop "Service Name"

Run the Batch file.

Hope it helps
Admin4XP
Try this:

Click Start -> Run -> Cmd.exe
FOR /F "delims=#" %c IN ('Type C:\computers.txt') Do sc \\%c config devicelock  start= disabled
ASKER CERTIFIED SOLUTION
Avatar of Gastone Canali
Gastone Canali
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry forgot the disable line :- S

 
Admin4XP:
Your command does not disable.

farhankazi:
Your command does not stop.
canali:
This script does not delete the service.
Try canali's batch for 'stop and disable'
Stop,Disable and delete. Any way to do this...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have create the group policy and ran gpupdate. The new policy is not getting applied. when I run a GPresult I get the following:

The name of the policy is -> Disable K9 Enable Windows Time
F:\>Gpresult

Microsoft (R) Windows (R) XP Operating System Group Policy Result tool v2.0
Copyright (C) Microsoft Corp. 1981-2001

Created On 11/23/2007 at 9:15:59 AM


RSOP results for STRATHCONA\brady on J2MGPC1 : Logging Mode
------------------------------------------------------------

OS Type:                     Microsoft Windows XP Professional
OS Configuration:            Member Workstation
OS Version:                  5.1.2600
Domain Name:                 STRATHCONA
Domain Type:                 Windows 2000
Site Name:                   Default-First-Site-Name
Roaming Profile:
Local Profile:               C:\Documents and Settings\brady
Connected over a slow link?: No


COMPUTER SETTINGS
------------------
    CN=J2MGPC1,CN=Computers,DC=strathcona,DC=ab,DC=ca
    Last time Group Policy was applied: 11/23/2007 at 9:15:45 AM
    Group Policy was applied from:      printsrv.strathcona.ab.ca
    Group Policy slow link threshold:   500 kbps

    Applied Group Policy Objects
    -----------------------------
        Default Domain Policy
        WSUS Update Policy
        Local Group Policy

    The following GPOs were not applied because they were filtered out
    -------------------------------------------------------------------
        Visio XP
            Filtering:  Not Applied (Empty)

        Project XP
            Filtering:  Not Applied (Empty)

        Access XP
            Filtering:  Not Applied (Empty)

    The computer is a part of the following security groups:
    --------------------------------------------------------
        BUILTIN\Administrators
        Everyone
        BUILTIN\Users
        NT AUTHORITY\NETWORK
        NT AUTHORITY\Authenticated Users
        J2MGPC1$
        Domain Computers


USER SETTINGS
--------------
    CN=Rory Brady,OU=Information Technology Services,OU=SC,DC=strathcona,DC=ab,D
C=ca
    Last time Group Policy was applied: 11/23/2007 at 9:15:45 AM
    Group Policy was applied from:      printsrv.strathcona.ab.ca
    Group Policy slow link threshold:   500 kbps

    Applied Group Policy Objects
    -----------------------------
        Restore Windows Update & Run
        Corporate Screen Blanker Policy
        Default Domain Policy
        Access XP
        Project XP
        Visio XP
        Windows Admin Pack

    The following GPOs were not applied because they were filtered out
    -------------------------------------------------------------------
        Disable K9 Enable Windows Time
            Filtering:  Not Applied (Empty)

        NTP
            Filtering:  Not Applied (Empty)

        WSUS Update Policy
            Filtering:  Not Applied (Empty)

        Local Group Policy
            Filtering:  Not Applied (Empty)

    The user is a part of the following security groups:
    ----------------------------------------------------
        Domain Users
        Everyone
        Remote Desktop Users
        BUILTIN\Power Users
        BUILTIN\Users
        BUILTIN\Administrators
        NT AUTHORITY\INTERACTIVE
        NT AUTHORITY\Authenticated Users
        LOCAL
        GG-ReportingService-Everyone
        GG-ITInventoryEditors
        TWGAdmins
        GG-KnowledgePathways-ContentAuthors
        Minions
        GG-Project 2002 Users
        GG-Camalot Users (Read Write)
        GG-IT (Full Control)
        GG-PosseLocAdmin
        GG-Rollout
        GG-Ricoh
        GG-ITInventoryViewers
        GG-IT Support (WRLEM)
        GG-OnDemandUsers
        domain superusers
        Domain Admins
        DL-PosseLocAdmin
        DL-IT (Full Control)
        DL-KnowledgePathways-EndUsers
        DL-ReportingService-Everyone
        DL-IT Support (WRLEM)
        DL-Ricoh
        DL-Camalot Users (Read Write)
        DL-OnDemandUsers

F:\>