VB - SCCM %LOCALAPPDATA% Detection Method


Use the following VB detection method to detect the presence of the OneDrive executable within the users %LOCALAPPDATA% directory. Remember the deployment must run as a user:



Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject("WScript.Shell")

If oFSO.FileExists(oShell.ExpandEnvironmentStrings("%LocalAppData%\Microsoft\OneDrive\OneDrive.exe")) Then
    WScript.StdOut.Write "The application is installed"
    WScript.Quit(0)
Else
    WScript.Quit(0)
End If

Comments