**Disconnec Wireless Networking**
Hi
This is very important that i know this...
I have created a vbscript that detects the NIC's IP Address and if the IP address is withing the conditions - it stops the following services:
Smart Card Service
Wireless Zone Configuration Service
Under the group policy set - user's cannot start services - so they cannot connect into a wireless network.
PROBLEM: When the user logs into the network with a network cable its fine, my script works.
But...
If they take out the network cable, and re-insert it? what happens - it assigns a DHCP address -
or if they log on locally - then they insert the network cable - it picks up an IP and wireless is available...
** I want to know either the following...
what triggers or whats the event that occurs when a network cable is inserted? how can i stop this? how can i possible trigger a VBScript to run when a network cable is inserted? is this possible? i know that there are apps for this (i.e. IPSwicther), but i want to avoid 3rd party apps...
I want to know whether it is possible to run my script when the network cable is inserted or removed?
Can anyone help?
Im very desperate!!!
Malar - thank you kindly - you have recommended a very good solution to me.
One question though - should i implement this in my logon script?
or should i have the logon script point to this file at end-of-file?
how do you think i should approach this?
i have a logon script that works fine, but how can i get a script to always run in the background?
Please help...
Create a class that extends from servicebase.. MSDN has an example of a simple service that extends from servicebase..
A sample installer code.. Compile both to a exe. you can install the exe using installutil from sdk tools
[RunInstaller(true)]
public class CServiceInstaller : Installer
{
private ServiceProcessInstaller MyServiceProcessInstaller;
private ServiceInstaller MyServiceInstaller;
public CServiceInstaller()
{
MyServiceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
MyServiceInstaller = new System.ServiceProcess.ServiceInstaller();
//TODO:1 Change the account in which the service runs as desired
MyServiceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.NetworkService;
//TODO:2 Give Descriptions of your service
MyServiceInstaller.Description = "NCL Test Service";
MyServiceInstaller.DisplayName = "NCLTestSampleService";
MyServiceInstaller.ServiceName = "NCLTestSampleService";
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
MyServiceProcessInstaller,MyServiceInstaller});
}
}
From MSDN..
The ServiceInstaller constructor sets the StartType property to ServiceStartMode.Manual to specify that a user start the service. You can reset the property to ServiceStartMode.Automatic to specify that the service start when the computer reboots.
The ServiceInstaller constructor sets the StartType property to ServiceStartMode.Manual to specify that a user start the service. You can reset the property to ServiceStartMode.Automatic to specify that the service start when the computer reboots.
Malar