script to search for desktop for mdb
Hello all,
I'm looking for a script that will search user's desktop for access database shortcuts. These are shortcuts for access programs on network drive. We want to upgrade to Office 2013, but many users have 2003 access database on their desktop so we want to find who has office 2003 databases. All users have office 2003 and access databases, but we want to find all access 2003 shortcut on their desktop.
Also I would like to have it input under custom inventory filed area. list sort when we inventory user's pc.
Please help.
-
I'm looking for it to check the user's c drive (mostly desktop for shortcuts to network drives, but c: too) and place the result in txt file that Kace can place on custom inventory. - Kdebiasse 9 years ago
Answers (5)
Searching for shortcuts wouldn't be the best way to go about this since there's the chance that users will not have shortcuts. What you'll want to do is look into O.M.P.M. or Telemetry, both from Microsoft. You'll have to setup an SQL database to capture inventory data from a module that you deploy to the computers. It can scan the local machines for all Office files as well as keep track of files that are used.
It takes some time to collect the data, depending on the number of users and their locations, and it takes more time to review the collected data to determine what files are important and those that are not. For example, it can find a file that hasn't been touched in the last 13 years but still show that it contains a macro that is incompatible with Office 2013. Only you would determine if it requires modification or if it can be ignored.
I'm looking for network databases that are shortcuts on the desktop. Is there any way to store that info on user's PC.
Something like this , but mdb shortcuts
'local_and_network_drives.vbs
Dim objFSO, newfolder
Dim strComputer, objWMIService
Dim fso, fsHandle, objShell,LogFileName, colItems, objItem
set objFSO=CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists("c:\KBOX") Then
newfolder = objFSO.CreateFolder ("c:\KBOX")
End If
Set objShell = CreateObject("Wscript.Shell")
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
If objFSO.FileExists("c:\KBOX\local_and_network_drives.txt") Then
fso.DeleteFile "c:\KBOX\local_and_network_drives.txt", True
End If
LogFileName= "C:\KBOX\local_and_network_drives.txt"
set fsHandle = fso.OpenTextFile (LogFileName,8,True)
sUser = ConsoleUser(".") ' use "." for local computer
Function ConsoleUser(sHost)
' Returns name of user logged on to console
' If no users are logged on, returns ""
Dim oWMI, colProc, oProcess, sUser, sDomain
Set oWmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(debug)}!\\" _
& sHost & "\root\cimv2")
Set colProc = oWmi.ExecQuery("Select Name from Win32_Process" _
& " Where Name='explorer.exe' and SessionID=0")
ConsoleUser = ""
For Each oProcess In colProc
lRet = oProcess.GetOwner(sUser, sDomain)
If lRet = 0 Then
ConsoleUser = sUser
End If
Next
End Function
fsHandle.Writeline Now & " - " _
& "Logged in user: " & suser _
fsHandle.Writeline "------------------------------------------------------"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDrives = objWMIService.ExecQuery _
("Select * From Win32_LogicalDisk Where DriveType = 3")
For Each objDrive in colDrives
fsHandle.Writeline objDrive.Name & " " & "Local Hard Drive"
Next
Set colDrives = objWMIService.ExecQuery _
("Select * From Win32_LogicalDisk Where DriveType = 5")
For Each objDrive in colDrives
fsHandle.Writeline objDrive.Name & " " & "CD/DVD Drive"
Next
Set colDrives = objWMIService.ExecQuery _
("Select * From Win32_LogicalDisk Where DriveType = 4")
For Each objDrive in colDrives
fsHandle.Writeline objDrive.Name & " " & objDrive.ProviderName _
Next
fsHandle.Writeblanklines 1
fsHandle.close
set objShell = Nothing
set fso = Nothing
Dim obj_Shell
Dim obj_FSO
Set obj_Shell = Wscript.CreateObject("Wscript.Shell")
Set obj_FSO = CreateObject("Scripting.FileSystemObject")
CheckPath obj_Shell.SpecialFolders("Desktop")
CheckPath obj_Shell.SpecialFolders("AllUsersDesktop")
Function CheckPath(str_Path)
Set obj_Folder = obj_FSO.GetFolder(str_Path)
For Each obj_File in obj_Folder.Files
If obj_FSO.GetExtensionName(obj_File) = "lnk" Then
MsgBox obj_File.Name
End If
Next
End Function