If we are using this in custom action of an MSI, then WScript.ScriptName or WScript itself won't work.
The below will give the execution location (i.e., msiexec.exe) but not the VBScript or MSI file location.
Set WshShell = CreateObject("WScript.Shell")
strCurDir = WshShell.CurrentDirectory
We can use below one to get the script location but it will work only in Immediate Execution but not in Deferred.
cdsd = Session.Property("SourceDir")
Please let me know if any other alternative to use in MSI Custom Actions, specially for deferred.