Fiziks Posted September 4, 2006 Report Share Posted September 4, 2006 Hey, I was planning on creating a .bat that will disable the net connection and "%windir%\system32\rundll32.exe user32.dll, LockWorkStation" and another that will enable the connection..i need some sort of code template, or at least the second and third commands respectively. anybody??!! Quote Link to comment Share on other sites More sharing options...
cozofdeath Posted September 5, 2006 Report Share Posted September 5, 2006 To stop the connection you could use:sc \\machine_name stop dhcpTo start it back up:sc \\machine_name start dhcpFor \\machine_name you would put your own, which can be found by right clicking My Computer and going to properties. Then go to the Computer Name tab. The command just stops the DHCP service, taking the ip address away as the result. If you don't like this method I'm sure there are more to be found, this is just how I would do it. Is this what you wanted? Quote Link to comment Share on other sites More sharing options...
Fiziks Posted September 5, 2006 Author Report Share Posted September 5, 2006 w000, this will suffice..gracias.. mucho gracias Quote Link to comment Share on other sites More sharing options...
Fiziks Posted September 5, 2006 Author Report Share Posted September 5, 2006 ok i have new question..I created a .bat (Lock.bat) with @echo offCALL D:\TEMP\bat-nttmp\killnet.batstart /MIN /HIGH /B C:\WINDOWS\system32\rundll32.exe user32.dll, LockWorkStationexitand a .bat (D:\TEMP\bat-nttmp\killnet.bat) containing:@echo offstart /B C:\WINDOWS\system32\sc.exe \\II stop dhcpupon opening [Lock.bat] the workstation locks yet the net still stays connected, wtf have I done?!!?(II is the name of the sys, btw)killnet works alonewhen i click it, all's wellbut the call from "lock.bat" isn't working...also, sometimes I get an error messages when attempting to sc \\xx stop dhcp saying <failed> because dependencies rely on this, is there a way I can override this? Quote Link to comment Share on other sites More sharing options...
cozofdeath Posted September 5, 2006 Report Share Posted September 5, 2006 Heres what I made and it seems to work for me.killnet.bat@echo offsc \\emachine stop dhcpcall C:\docume~1\owner\desktop\lockme.batlock.batrundll32.exe user32.dll, LockWorkStationYou can always use the && operator between commands so if the first command executes successfully then the second will or the net stop dhcp command. I'm not sure how you can force them dependencies off though. If I see anything on the net I'll post back. Quote Link to comment Share on other sites More sharing options...
Fiziks Posted September 6, 2006 Author Report Share Posted September 6, 2006 Heres what I made and it seems to work for me.killnet.bat@echo offsc \\emachine stop dhcpcall C:\docume~1\owner\desktop\lockme.batlock.batrundll32.exe user32.dll, LockWorkStationYou can always use the && operator between commands so if the first command executes successfully then the second will or the net stop dhcp command. I'm not sure how you can force them dependencies off though. If I see anything on the net I'll post back....killnet.bat@echo offsc \\system_name stop dhcpcall C:\docume~1\owner\desktop\LOCK.batLOCK.batrundll32.exe user32.dll, LockWorkStation"sc \\system_name stop dhcp" this doesn't work, not alone or in conjunction...er, don't you have to type "start" to execute a commandand i tried...killnet.bat@echo offstart sc \\system_name stop dhcpcall C:\docume~1\owner\desktop\LOCK.batLOCK.batrundll32.exe user32.dll, LockWorkStationlocks, but the bits are still streaming between myself and my isp...I'm using server 2003..thanks, btw Quote Link to comment Share on other sites More sharing options...
cozofdeath Posted September 7, 2006 Report Share Posted September 7, 2006 You should not have to enter the "start" command before a command. The only reason you would is if C:\windows\system32 is not in your system environment. To see if it is enter the command "path" without the quotes. It should display a couple different directories but you'll want C:\windows\system32 in there. If it isn't just type "path ;C:\WINDOWS\system32" in without the quotes to add it or right-click on My Computer, properties, Advanced tab, Environment Variables button, and add it to the system variables.Also, how do you know the bits are still streaming? Quote Link to comment Share on other sites More sharing options...
Fiziks Posted September 7, 2006 Author Report Share Posted September 7, 2006 You should not have to enter the "start" command before a command. The only reason you would is if C:\windows\system32 is not in your system environment. To see if it is enter the command "path" without the quotes. It should display a couple different directories but you'll want C:\windows\system32 in there. If it isn't just type "path ;C:\WINDOWS\system32" in without the quotes to add it or right-click on My Computer, properties, Advanced tab, Environment Variables button, and add it to the system variables.Also, how do you know the bits are still streaming?hereit still doesn't work, with or without start, arrrrggh Quote Link to comment Share on other sites More sharing options...
cozofdeath Posted September 8, 2006 Report Share Posted September 8, 2006 k, try this...killnet.bat@echo offnet stop dhcpcall C:\docume~1\owner\desktop\LOCK.batLOCK.batrundll32.exe user32.dll, LockWorkStation Quote Link to comment Share on other sites More sharing options...
Fiziks Posted September 9, 2006 Author Report Share Posted September 9, 2006 ok, that works, but then this pops up...can i make it override this and stop the WinHTTP Wep Proxy A-D Service?also i'd then have to add something to start the service in the .bat used to connect dhcp... or no?! Quote Link to comment Share on other sites More sharing options...
cozofdeath Posted September 10, 2006 Report Share Posted September 10, 2006 Thats wierd. I didn't have that problem on xp home or server 2003 enterprise. That service can be disabled for good if your not using a proxy server to download your windows updates. You could add something like this to your batch file.sc \\II config winhttpautoproxysvc start= disableTo start it back up, it would be sc \\II config winhttpautoproxysvc start= demandThere has to be a space after the = signor stopping that service if its already started will work, like thisnet stop winhttpautoproxysvc && net stop dhcpTo start it back up, it would be net start dhcp && net start winhttpautoproxysvc Quote Link to comment Share on other sites More sharing options...
Fiziks Posted September 10, 2006 Author Report Share Posted September 10, 2006 sc \\II config winhttpautoproxysvc start= disableTo start it back up, it would be sc \\II config winhttpautoproxysvc start= demandThere has to be a space after the = signor stopping that service if its already started will work, like thisnet stop winhttpautoproxysvc && net stop dhcpTo start it back up, it would be net start dhcp && net start winhttpautoproxysvcI tried...net stop winhttpautoproxysvc && net stop dhcpit said service failed to shut down.....I tried disabling the service altogether, I then tried "net stop dhcp".. it stopped the connection but when I tried to start it (net start dhcp) again it failed...i checked connection settings, repair failed, disable/enable failed...then after a logoff/login still no connection...restart resolved connection again...can i debug this?!?!? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.