Monitor Share Usage for File Server Migration
How to monitor share access on a file server.
I needed a way to monitor the usage of particular shares on a file server as we are looking to move to a clustered file server, and you need to create a resource for every share.
Our existing file server has many shares on it, but most of them are unused, as we point most users through DFS. I could not find any way of collating information as to which SHARES where used to connect to a particular file, as auditing only tells you which files are actually accessed. To this end, I wrote a simple vb script which creates a comma delimited file with the maximum usage record for each share. It does not tell uswho has accessed each share, but it gives us a starting point to find out which shares need to be kept, or which users we need to educate not to use the shares when we migrate.
The script below accomplishes the task. Leave it running for a few days then view the CSV file in Excell…
————————————————————————————————–
‘ Name: sharemon.VBS
‘ Purpose: To monitor share path usage on a file server
‘
‘ check command line
GetArgs strComputername,strOutputFile,CorrectSyntax
If CorrectSyntax Then
Set fso = CreateObject(“Scripting.FileSystemObject”)
wscript.echo “Monitoring Share usage on ” & strComputername & ” To file ” & strOutputFile
wscript.echo “Press CTRL-C To Stop…”
wscript.echo “”
Set fs = GetObject(“WinNT://” & strComputername & “/LanmanServer”)
Dim ShareList(500,3)
Sharenum = 1
‘ Populate ShareList with name, path, and CurrentUserCount of each share
For Each share In fs
ShareList(sharenum,1) = share.name
ShareList(sharenum,2) = share.path
ShareList(sharenum,3) = share.CurrentUserCount
Sharenum = Sharenum + 1
Next
writeArray ShareList, strOutputFile, sharenum
‘ Now monitor the shares on the server to watch for any upward movement on the CurrentUserCount for each share
Do
Sharenum = 1
For Each share In fs
If ShareList(sharenum,3) < share.CurrentUserCount Then
ShareList(sharenum,3)=share.CurrentUserCount
End If
Sharenum = Sharenum + 1
Next
writeArray ShareList, strOutputFile, sharenum
wscript.echo “.”
Wscript.Sleep 5000
Loop
Else
DisplayHelp
wscript.quit
End If
Sub GetArgs(strComputername,strOutputFile,CorrectSyntax)
Set Args = WScript.Arguments
If args.count = 2 Then
CorrectSyntax = True
strComputername= args(0)
strOutputFile= args(1)
Else
CorrectSyntax = False
End If
End Sub
Sub DisplayHelp
wscript.echo “Keeps a count of the maximum number of accesses to particular shares on a File server”
wscript.echo “adn logs it to a file”
wscript.echo “cscript sharemon.VBS /? or /Help ———————————– Displays this help screen”
wscript.echo “cscript sharemon.VBS Servername”
wscript.echo “”
End Sub
Sub writeArray(arr,writeFile,iLines)
Set file = fso.openTextFile(writeFile, 2, True)
For i = 1 To iLines
file.writeLine arr(i,1) & “,” & arr(i,2) & “,” & arr(i,3)
Next
file.close
Set file=Nothing
end sub
Article written by MyComputerAid.com
2003 server - Sep 30, 2008 22:34 - 0 Comments
instant messaging srv records
More In Computers & PC
- Howto secure wordpress
- Simple wordpress upgrade from SSH howto
- permanently delete your facebook account
- Creating a Sound File
- Talking to the Mouse
Microsoft Outlook - Mar 22, 2009 11:22 - 0 Comments
Outlook: Duplicates in Mailbox
More In Computers & PC
- Howto secure wordpress
- Simple wordpress upgrade from SSH howto
- permanently delete your facebook account
- Creating a Sound File
- Talking to the Mouse
Microsoft Desktop, Web browsers and Internet, Windows 2000, Windows 7, Windows 98, Windows Firewall and networking, Windows Vista, Windows XP - Feb 8, 2010 18:09 - 0 Comments
Disable Proxy settings in IE
More In Computers & PC
- Howto secure wordpress
- Simple wordpress upgrade from SSH howto
- permanently delete your facebook account
- Creating a Sound File
- Talking to the Mouse
Leave a Reply
You must be logged in to post a comment.