Skip to content

Detection Method - Custom Script

Featured Replies

Hi,

 

I'm having issue using custom detection scripts. More specifically how to exit the detection script to say detected or not.

 

My application is a script that will delete two desktop icons.

 

My detection script checks if and icon exists and if it does increment a count. If the count is 0 that is no icons exist then I want to exit the script and have the application detected as installed.

 

This is what I ran with ...

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

File1="C:\Users\Public\Desktop\HP TRIM Desktop.lnk"

File2="C:\Users\Public\Desktop\HP TRIM Queue Processor.lnk"

Dim count

count = 0

If objFSO.FileExists(File1) then

count= count + 1

End If

If objFSO.FileExists(File2) then

count = count + 1

End If

If count = 0 then

WScript.Quit(0)

End If

 

The logs showed the application not detected so ran my Script correctly. Then when it checked after the install it still showed as undetected.

 

Can anyone explain how I can exist my scripts correctly to show presence of an application?

 

Cheers,

Why not use the BUILTIN functionality in ConfigMgr for this? If you want to report about the Application you can use the inventories and if you want to install the Application and need to know if it already exists just use the builtin Application Detection Methods..

  • Author

Hi Peter,

 

Not sure if I explained myself correctly. I basically have an installation to run (HP TRIM) this installation which puts three desktop icons to C:\Users\Public\Desktop. Two icons are not needed so I need to remove these.

 

For the HP TRIM deployment method I use the msi detection that works no problem. Two remove the icons I have a script to delete them which I have made into a second deployment type. I can't use a built in file detection as I want to run my script if the icons are there (therefore run script to delete them) but if the files are detected the deployment method is says it is installed and the script won't run to delete the icons. Basically I think I need a big NOT in front of the file detection.

 

So I tried to to a custom detection script above which I'm not sure how to exit out for detection.

 

I suppose a work around would be to wrap the TRIM msi and then my file delections in one script, do a manual deployment type and just check for TRIM installed. This doesn't seem to be how things are meant to be done though. I really need some sort of post installation task.

 

Cheers,

When it's just about two shortcuts that are not needed then in case you still need to deploy the app I would solve it with a customization file (mst) for the msi and in case it's already deployed I would make one script that detects and deletes. Sample:

If oFSO.FileExists(File1) Then
oFSO.DeleteFile File1
End If

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.