Jump to content

Recommended Posts


Posted

More information is required, if you want help you must be willing to provide sufficient information for us to work with!

Posted

I have few laptops on where is installed firewal. This firewal is runnig as service. So i need to deploy script via GPO, which will stop the service, when laptop is in the domain, when laptop is out from our domain then the service must be running.

I was thinking in this style. Ping domain DC if success then stop the service, if not start the service.

Plese let me know if this is enough information.

Posted

Here's a quick idea using a Windows NT Command Script: this is most likely English Language dependant

@Echo off&Setlocal enableextensions
(Set FW=ServiceName.ext)
For /f "tokens=3*" %%a In (
'Net Config Work^|Findstr/ib /c:"Full Computer Name" /c:"Logon Domain"'
) Do If %%b' Neq ' (Set C_=%%b) Else (Set D_=%%a)
If /i %D_% Neq %C_% Net Stop %FW%

You'd need to change ServiceName.ext in line 2 to the name of the service you need to stop.

Posted

Okay, although it appears to me that this is pretty one-sided affair!

Goal:

  • Check to see if the user has logged on successfully to a Domain.
  • If so, Stop the non-required service

Method:

  • Parse the output of NET CONFIG WORKstation
  • If LOGON DOMAIN is not the same as the FULL COMPUTER NAME then the user is logged onto a domain and the service is stopped.

There may be other ways to do it, but since the information you provided was sparse, I was unable to provide anything better.

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...