alexjlewis
asked on
Obtain exclusive (read write) access to network files with VB.NET
Until recently I've used a simple batch file to perform overnight maintenance of our Source Safe database. This batch file is run on the same server that hosts the SourceSafe DB.
The following line checks for files on the server being accessed by users client PCs, then closes the files so that maintenance can begin:
REM *** Close All VSS Files Opened by Network Clients ***
FOR /f "skip=4 tokens=1,2" %%a IN ('net files') DO IF %%b GTR %_ROOT% net files %%a /close
I'm replacing the batch file with a .NET application and therefore need to achieve the same thing through VB.NET.
All help much appreciated!
Alex
The following line checks for files on the server being accessed by users client PCs, then closes the files so that maintenance can begin:
REM *** Close All VSS Files Opened by Network Clients ***
FOR /f "skip=4 tokens=1,2" %%a IN ('net files') DO IF %%b GTR %_ROOT% net files %%a /close
I'm replacing the batch file with a .NET application and therefore need to achieve the same thing through VB.NET.
All help much appreciated!
Alex
ASKER
"I'm replacing the batch file with a .NET application and therefore need to achieve the same thing through VB.NET."
Sorry if the above wasn't clear. How else can I put it? What's the VB equivalent to achieve what I'm currently doing with the line in the existing batch file that reads:
FOR /f "skip=4 tokens=1,2" %%a IN ('net files') DO IF %%b GTR %_ROOT% net files %%a /close
Many thanks.
Alex
Sorry if the above wasn't clear. How else can I put it? What's the VB equivalent to achieve what I'm currently doing with the line in the existing batch file that reads:
FOR /f "skip=4 tokens=1,2" %%a IN ('net files') DO IF %%b GTR %_ROOT% net files %%a /close
Many thanks.
Alex
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Bob