Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Stopping services

Featured Replies

Hi, i need script which will do stop service if the computer is in domain, if not than service should be started.

  • Author

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.

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.

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.

Can you please explain this in few words :) ?

Read this:

http://www.robvanderwoude.com/ntfortokens.html

Try opening a console and issueing this command:

Net Config Workstation

then try issueing:

Net Config Work

(it will give the same output)

Try the above both when connected and when not connected to a domain.

then try issueing:

tasklist

Then read this:

http://www.ss64.com/nt/net_service.html

jaclaz

  • 2 weeks later...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.