|
Each contribution is licensed to you under a License Agreement by its owner, not Microsoft. Microsoft does not guarantee the contribution or purport to grant rights to it.
|
Categories |
List Backup Files(Community)
Script Code
VBScript
'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalSCRIPT(TM)
'
' NAME: listBKF.vbs
'
' AUTHOR: Sean Rooney
' DATE : 22/06/2005
'
' COMMENT: A handy script to list all BKF files on a range of servers, to
' ease backup checking. I schedule this overnight and in the AM
' it's open on my desk in Excel
'==========================================================================
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
'arrayComputers = Array("SCHOOL-DC01","SCHOOL-DC02","SCHOOL-DC03","SCHOOL-DC04",_
"PRDSPARE-DC99","SCHOOL-BH01","SCHOOL-BH02","SCHOOL-BH03","SCHOOL-BH04", _
"SCHOOL-GC01","SCHOOL-GC02","SCHOOL-GC03","SCHOOL-GC04")
arrayComputers = Array("Server1","Server2","Server3") 'create your list of servers here
ListBKF 'Calls the function ListBKF
Set objExcel = Nothing
' End of program
'======================================= Functions ========================================
Function ListBKF
' Bind to worksheet.
objExcel.ActiveWorkbook.Worksheets.Add
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
objSheet.Name = "BKF Files"
x = 1
For Each strServer In arrayComputers
objExcel.Cells(x, 1) = strServer
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strServer & "\root\cimv2")
Set colFiles = objWMIService. _
ExecQuery("Select * from CIM_DataFile where Extension = 'bkf'")
'change bkf to whatever extension you need
For Each objFile in colFiles
objExcel.Cells(x, 2) = objFile.Drive & objFile.Path & objFile.Filename & _
"." & objFile.Extension
objExcel.Cells(x, 3) = Round(objFile.FileSize/1024000000,2) 'give size in GB
objExcel.Cells(x, 4) = WMIDateStringToDate(objFile.LastModified)
x = x + 1
Next
x = x + 1
Next
End Function 'ListBKF
Function WMIDateStringToDate(dtmDate)
'WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 7, 2) & "/" & _
Mid(dtmDate, 5, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function
Platforms
For online peer support, join
The Official Scripting Guys Forum!
To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script.
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Be the first to create a discussion.
|