Close locked File

by Frequent Contributor on ‎2014-07-07 04:58 PM

Hi All

As cDOT does not currently support the ability to close locked files via the MMC, here is an example workflow of how to automate the process of close a locked file on a CIFS share (EG microsoft access database).

The workflow accepts a single input parameter containing either the DFS or UNC path of a file to be closed in "double quotes"

For example:

DFS = "\\testlab.local\data\qtree01\data\reports\reports.accdb"

UNC = "\\nvaunsw100\qtree01$\data\reports\reports.accdb"

If the file is a DFS path the workflow will export the DFS namespace and enumerate the UNC Path of the enabled DFS target (This requires the DFS managment tools to be installed on your WFA server).

It uses the "dfsutil.exe root export" command to export the DFS namespace to xml which is parse to find the enabled target of the specified DFS link.

The UNC Path is translated to the file mount point and parsed to the "vserver locks break" command.

Here is an example of the workflow logs ensuring the process is auditable.

16:02:11.074 INFO  [null] ***** Workflow Execution Started *****

16:02:11.104 INFO  [Close Locked File] ### Command 'Close Locked File' ###

16:02:31.694 INFO  [Close Locked File] Executing command: ./Close_Locked_File2041417404805546855.ps1 -FileSpec '\\testlab.local\data\qtree01\databases\reports\reports.accdb'

16:02:31.804 INFO  [Close Locked File] Executed Command: dfsutil.exe root export \\testlab.local\data \dfs.xml verbose downlevel

16:02:31.994 INFO  [Close Locked File] Credentials successfully provided for 'nvaunsw100_mgmt'

16:02:48.375 INFO  [Close Locked File] Connected to vserver "nvaunsw100"

16:02:49.165 INFO  [Close Locked File] Enumerated the mount point for CIFS share "qtree01$" as "/nswsyd0101/qtree01"

16:02:51.615 INFO  [Close Locked File] Executed Command: set advanced;vserver locks break -vserver nvaunsw100 -volume nswsyd0101 -lif * -path /nswsyd0101/qtree01/databases/reports/reports.accdb

16:02:51.695 INFO  [Close Locked File] Command completed, took 40571 milliseconds

16:02:51.725 INFO  [null] ***** Workflow Execution Completed *****

The workflow requirements are: 

  • The “vsadmin” account enabled on the vserver serving the CIFS share
  • The credentials for the “vsadmin” account are added to the WFA Cache
  • The file input parameter must be in double quotes
  • DFS Management utilities installed on the WFA server
    >Install-WindowsFeatuure RSAT-DFS-Mgmt-Con

NOTE: If WFA is installed on Windows Server 2012 R2 the DFSN powershell module could be integrated to manage the DFS namespace instead of "dfsutil.exe"

Hope that helps

Cheers Matt


This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.