[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1206
  • Last Modified:

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
0
bsharath
Asked:
bsharath
  • 4
  • 3
  • 2
  • +3
2 Solutions
 
merowingerCommented:
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!
0
 
bsharathAuthor Commented:
For say 100 Machines how do i do this.
0
 
merowingerCommented:
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!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Admin4XPCommented:
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
0
 
Farhan KaziSystems EngineerCommented:
Try this:

Click Start -> Run -> Cmd.exe
FOR /F "delims=#" %c IN ('Type C:\computers.txt') Do sc \\%c config devicelock  start= disabled
0
 
canaliCommented:
@Echo Off
::script1
setlocal
::stop and disable
set service=devicelock
FOR /F %%c IN (C:\computers.txt) Do (
      Echo stop service %%c
      sc \\%%c stop %service%
      sc  \\%%c config %service% start= disabled
)


@Echo Off
::
::script2
setlocal
::stop and remove
set service=devicelock
FOR /F %%c IN (C:\computers.txt) Do (
      Echo stop service %%c
      sc \\%%c stop %service%
      sc \\%%c delete %service%
)
0
 
Admin4XPCommented:
Sorry forgot the disable line :- S

 
0
 
bsharathAuthor Commented:
Admin4XP:
Your command does not disable.

farhankazi:
Your command does not stop.
0
 
bsharathAuthor Commented:
canali:
This script does not delete the service.
0
 
Farhan KaziSystems EngineerCommented:
Try canali's batch for 'stop and disable'
0
 
bsharathAuthor Commented:
Stop,Disable and delete. Any way to do this...
0
 
Farhan KaziSystems EngineerCommented:
::stop, disable and remove
@Echo Off
setlocal
set service=devicelock
FOR /F %%c IN (C:\computers.txt) Do (
      Echo stop service %%c
      sc \\%%c stop %service%
      sc \\%%c config %service% start= disabled
      sc \\%%c delete %service%
)
0
 
rorybradyCommented:
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:\>













0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 4
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now