Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable File Sharing w/VBS?

Status
Not open for further replies.

demoniac

Programmer
Jun 14, 2001
63
US
Hello. I'm writing a program to assist in defrag automation. I've got everything working except I need to be able to turn off file sharing during the defrag (to keep it from restarting over and over everytime a computer gets something from that machine).

Anybody have any ideas on how to do this?

Thanks,
demoniac
 

demoniac,

This should work,

Set WshShell = Wscript.CreateObject("Wscript.Shell")
sharename = "YourShareNameHere"
cmdline = "net share " & ShareName & " /delete"
Return = WshShell.Run(cmdline, 0, TRUE)


Fengshui1998
 
Fengshui,

Well that would work if my company wasn't too cheap to get off of windows 98. ;) Any ideas on how to do it on a 95/98 system?

Thanks,
 
How about just putting the command line in a BAT file? Can't get any cheaper than that!



net share "yoursharename" /delete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top