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.

1 Comment   [ + ] Show comment
  • 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 5 years ago

Answers (5)

Posted by: vjaneczko 5 years ago
9th Degree Black Belt

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.

Posted by: anonymous_9363 5 years ago
Red Belt
Also, please remove your duplicate post.
Posted by: Kdebiasse 5 years ago
8th Degree Black Belt

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


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
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"


Set colDrives = objWMIService.ExecQuery _
    ("Select * From Win32_LogicalDisk Where DriveType = 5")
For Each objDrive in colDrives

fsHandle.Writeline objDrive.Name & " " & "CD/DVD Drive"


Set colDrives = objWMIService.ExecQuery _
    ("Select * From Win32_LogicalDisk Where DriveType = 4")
For Each objDrive in colDrives

fsHandle.Writeline objDrive.Name & " " & objDrive.ProviderName _


fsHandle.Writeblanklines 1

set objShell = Nothing
set fso = Nothing

Posted by: aragorn.2003 5 years ago
Red Belt
What your script does, is to list all drives and write that to a logfile.

But if you want to walk thorugh the desktop folder(s) and list all files, or search for an extension you can probably use this script. it´s just an example. change it as you need it to work and maybe write a logfile.

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
End Function
Posted by: Kdebiasse 5 years ago
8th Degree Black Belt
Is there away kace can pick it up when force update user name and have it display
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ