Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

force disconnection on a shared folder

Posted on 2007-04-09
5
Medium Priority
?
994 Views
Last Modified: 2013-12-05
Hi...we need to update numerous of files under a shared folder in a windows 2000 server, since these files are accessed by an application which is running on the client side, that causes the updating process failed due to some of the files are locked.

I know net file or net session can be used to force  the disconnection.  but how about automating the process by creating the VBScript job? any sample available?

Alternatlively, would stop the file share do the same work on the fly?

Regards,
fshguo.
 
0
Comment
Question by:fshguo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18879398
net stop server would prevent 'any' connections...are you looking to stop this share only?
0
 

Author Comment

by:fshguo
ID: 18879857
yes, I am looking at to stop this share only.
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 18880281
Something like this perhaps?

strShare = "scripts"

Dim objShell: Set objShell = CreateObject("Wscript.Shell")
Dim objExec: Set objExec = objShell.Exec("net share " & strShare)
strOut = objExec.StdOut.ReadAll
strPath = Trim(Replace(Replace(Mid(strOut, InStr(strOut, "Path  "), InStr(strOut, "Remark ") - InStr(strOut, "Path ")), "Path ", ""), vbNewLine, ""))
objShell.Run "Net share " & strShare & " /delete", 0
strMsg = "Press OK when you're ready to reenable the share" & vbNewLine & "(pressing cancel will lose the share)"
strResp = MsgBox(strMsg, vbOKCancel, "Waiting...")
If strResp = vbCancel Then wscript.quit
objShell.Run "Net share " & strShare & "=" & strPath
Set objExec=Nothing
set objShell=Nothing
wscript.quit
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The question has been asked on multiple occasions as to how best to do printing in a remote desktop or terminal services environment.   It seems that this particular question has plagued several people and most especially as Terminal Services, as…
Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip Migration Tip #1 – Source Server Health can be found here: http://www.experts-exchang…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question