Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

vbs script for manage windows xp service and registry

- - - - -

  • Please log in to reply
9 replies to this topic

#1
hessam

hessam

    Member

  • Member
  • PipPip
  • 135 posts
  • Joined 15-December 07
Hi,
i need vbs script to manage windows xp service
like automatic,Manual,Disabled,Start,Stop,Pause,Resume
Example For Task Scheduler Service.

also i need vbs script to put below registry in a vbs file and silently Apply To the registry

[HKEY_CURRENT_USER\Software\KMPlayer\WideAlbum\(Default Album)]
@="Playlist\\Default.kpl"

Thanks Best Regards.


How to remove advertisement from MSFN

#2
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,543 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Please be more specific, 'manage' is too vague.

You need to tell us a specific purpose for the vbscript, to have something which can interactively configure both start and state is to have a GUI. We already have that with 'services.msc'

#3
hessam

hessam

    Member

  • Member
  • PipPip
  • 135 posts
  • Joined 15-December 07
Hello,
about manage i say that i need change state of service to ,automatic,Manual,Disabled,Start,Stop,Pause,Resume
i know about 'services.msc' .but i want vbs script to put in startup to run it from there. also i take less time to manage windows servive
also i stopped DNS Client service but some time i need to use ipconfig /flushdns command
so this service must be started.so i need vbs script to start this service from desktop then from cmd use the command
then run script to stop again this service
also i need to pause Telephony service on startup.
so i dont want use gui like 'services.msc'



thanks,

Edited by hessam, 15 November 2012 - 05:52 AM.


#4
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,543 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

I'm not sure that you understood the point I was making so I'll try to put it a different way. You are asking for a script which can stop a service, not a specific service but one or several of your choice at a time or times of your choosing and from either the desktop or start up location. It must also be able to start services, pause services and resume them too.

In order for your script to be able to take a Service or Display Name of your choosing (as input), enumerate its state and start up settings, and present them for you in a manner for you to customise to your liking. It would need to be interactive, (it would have to be in a question and answer format). To do this it could be a basic question with written answer format or a more elaborate GUI with drop down boxes or toggles.

In order to perform the changes your script would need to be able to determine whether or not your chosen service is capable of starting, stopping or pausing or resuming, (and has actually done so if chosen). It would need to check for dependencies which may be affected by or may themselves affect the selection you've chosen.

To have a non interactive method would mean creating separate scripts for each task you want to perform, and since there are already methods of doing this using NET.EXE or SC.EXE you may be just as well advised creating small batch files than vb scripts using WMI.

#5
hessam

hessam

    Member

  • Member
  • PipPip
  • 135 posts
  • Joined 15-December 07
I'm not sure that you understood the point I was making so I'll try to put it a different way.
You are asking for a script which can stop a service, not a specific service but one or several
of your choice at a time or times of your choosing and from either the desktop or start up location.
It must also be able to start services, pause services and resume them too.
In order for your script to be able to take a Service or Display Name of your choosing (as input),
enumerate its state and start up settings, and present them for you in a manner for you to customise
to your liking


frist thanks for response and help me sory my english no so good
in my system must service disaled.

yes but i want do it with seprate script
example for DNS Client,it always disabled and stopped in my system.so we know state of it
then i need scritp to enable and start it.
then need another script to disable and stop it.
and another one is a Telephony service that is always in manual and strated sate in my pc.
even if i pause it,that started on next pc boot.
so i want just make one another one script to pause it then put it in my startup folder
and i know if disable some service like Telephony or DHCP Client that cause prblem
like acquire internet connection address error.so we know waht servive we need and state of that






In order for your script to be able to take a Service or Display Name of your choosing (as input),
enumerate its state and start up settings, and present them for you in a manner for you to customise
to your liking. It would need to be interactive, (it would have to be in a question and answer format).
To do this it could be a basic question with written answer format or a more elaborate GUI with drop down boxes or toggles.

so that mean when i launch script its get service name
then that ask me waht to do?its not bad but i thinks scripting this get alot time.
but if we know name and state of servive i choice frist method





In order to perform the changes your script would need to be able to determine whether or not your chosen
service is capable of starting, stopping or pausing or resuming, (and has actually done so if chosen).
It would need to check for dependencies which may be affected by or may themselves affect the selection you've chosen.


To have a non interactive method would mean creating separate scripts for each task you want to perform,
and since there are already methods of doing this using NET.EXE or SC.EXE you may be just as well advised
creating small batch files than vb scripts using WMI.

also batch file not bad but in hiden mode or scripting using WMI not bad.

also what about
vbs script to put below registry in a vbs file and silently Apply To the registry

[HKEY_CURRENT_USER\Software\KMPlayer\WideAlbum\(Default Album)]
@="Playlist\\Default.kpl"


#6
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,579 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Idea. :w00t:
See if nirsoft nircmd command "service" would do:
http://www.nirsoft.n...ils/nircmd.html
http://www.nirsoft.n...cmd2.html#using

jaclaz

#7
hessam

hessam

    Member

  • Member
  • PipPip
  • 135 posts
  • Joined 15-December 07
Thank you very much jaclaz. that great and easy to use

i maked cmd file and put below line on it.
this a for pause Telephony service.
nircmdc service pause TapiSrv
this for DNS Client
service start Dnscache

EveryBody need to know what is it best state of service,see below link
http://www.theelderg...vices_guide.htm

also see below for service name to uset with nircmd
ServiceName DisplayName
----------- -----------
Alerter Alerter
ALG Application Layer Gateway Service
AppMgmt Application Management
aspnet_state ASP.NET State Service
AudioSrv Windows Audio
BITS Background Intelligent Transfer Service
Browser Computer Browser
CiSvc Indexing Service
ClipSrv ClipBook
clr_optimization_v2.0.50727_32 .NET Runtime Optimization Service v2.0.50727_X86
COMSysApp COM+ System Application
CryptSvc Cryptographic Services
DcomLaunch DCOM Server Process Launcher
Dhcp DHCP Client
dmadmin Logical Disk Manager Administrative Service
dmserver Logical Disk Manager
Dnscache DNS Client
DynDNS Updater DynDNS Updater
ERSvc Error Reporting Service
Eventlog Event Log
EventSystem COM+ Event System
FastUserSwitchingCompatibility Fast User Switching Compatibility
FontCache3.0.0.0 Windows Presentation Foundation Font Cache 3.0.0.0
helpsvc Help and Support
HidServ Human Interface Device Access
hpdj hpdj
hpdj3500 hpdj3500
HTTPFilter HTTP SSL
idsvc Windows CardSpace
ImapiService IMAPI CD-Burning COM Service
lanmanserver Server
lanmanworkstation Workstation
LmHosts TCP/IP NetBIOS Helper
MDM Machine Debug Manager
Messenger Messenger
mnmsrvc NetMeeting Remote Desktop Sharing
MSDTC Distributed Transaction Coordinator
MSIServer Windows Installer
NetDDE Network DDE
NetDDEdsdm Network DDE DSDM
Netlogon Net Logon
Netman Network Connections
NetTcpPortSharing Net.Tcp Port Sharing Service
Nla Network Location Awareness (NLA)
nlsvc NetLimiter
NtLmSsp NT LM Security Support Provider
NtmsSvc Removable Storage
ose Office Source Engine
PlugPlay Plug and Play
PolicyAgent IPSEC Services
ProtectedStorage Protected Storage
RasAuto Remote Access Auto Connection Manager
RasMan Remote Access Connection Manager
RDSessMgr Remote Desktop Help Session Manager
RemoteAccess Routing and Remote Access
RemoteRegistry Remote Registry
rpcapd Remote Packet Capture Protocol v.0 (experimental)
RpcLocator Remote Procedure Call (RPC) Locator
RpcSs Remote Procedure Call (RPC)
RSVP QoS RSVP
SamSs Security Accounts Manager
SCardSvr Smart Card
Schedule Task Scheduler
seclogon Secondary Logon
SENS System Event Notification
SharedAccess Windows Firewall/Internet Connection Sharing (ICS)
ShellHWDetection Shell Hardware Detection
Spooler Print Spooler
srservice System Restore Service
SSDPSRV SSDP Discovery Service
stisvc Windows Image Acquisition (WIA)
SwPrv MS Software Shadow Copy Provider
SysmonLog Performance Logs and Alerts
TapiSrv Telephony
TermService Terminal Services
Themes Themes
TlntSvr Telnet
TrkWks Distributed Link Tracking Client
upnphost Universal Plug and Play Device Host
UPS Uninterruptible Power Supply
VSS Volume Shadow Copy
W32Time Windows Time
WebClient WebClient
winmgmt Windows Management Instrumentation
WmdmPmSN Portable Media Serial Number Service
Wmi Windows Management Instrumentation Driver Extensions
WmiApSrv WMI Performance Adapter
wscsvc Security Center
wuauserv Automatic Updates
WZCSVC Wireless Zero Configuration
xmlprov Network Provisioning Service

Edited by hessam, 17 November 2012 - 03:05 AM.


#8
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,579 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

Thank you very much jaclaz. that great and easy to use

Good :).
Just for the record, there is also a small nirsoft GUI app, Serviwin:
http://www.nirsoft.n...s/serviwin.html
tha will show (and can output as list) all services (and their "DisplayName"s, that may change on localized versions) .

jaclaz

#9
bphlpt

bphlpt

    MSFN Addict

  • Member
  • PipPipPipPipPipPipPip
  • 1,798 posts
  • Joined 12-May 07
  • OS:none specified
  • Country: Country Flag

EveryBody need to know what is it best state of service,see below link
http://www.theelderg...vices_guide.htm


In addition to the link you provided, another very excellent source of service info is Black Viper's x86 XP SP3. Black Viper also has suggested service settings for all Windows OS from Win2K through Win8. (He has been around a long time and is well known.) In addition to the various suggestions and tools available on his site, his recommendations have even been incorporated into a tool to set all the service settings up for you to either his Safe, Tweaked, or BareBones settings with just a single step. That free tool is SMART. It works with XP, Vista and Win7. Just another option.

Cheers and Regards

Edited by bphlpt, 17 November 2012 - 05:24 AM.

Posted Image


#10
hessam

hessam

    Member

  • Member
  • PipPip
  • 135 posts
  • Joined 15-December 07
nirsoft provide small,useful,easy to use software thanks jaclaz
thanks bphlpt for Black Viper's x86 XP SP3 link

This is All My Need that nircmd solved my problem
save it in *.cmd
:: Pause Telephony Service ::
nircmdc service pause TapiSrv

:: Start And Enable DNS Client Service ::
nircmdc service auto Dnscache
nircmdc service start Dnscache

::flushed the DNS Resolver Cache::
::And if Start And Enable DNS Client::
::Service worked you get this info::
::Successfully flushed the DNS Resolver Cache.::
ipconfig /flushdns

:: Stop And Disable DNS Client Service ::
nircmdc service stop Dnscache
nircmdc service disabled Dnscache




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users