Pages

Monday, 16 July 2012

Remove Excel Addin - VBScript

Following VBScript can be used to delete Excel Addin
Change AddIn_path to the Excel Addin file that needs to be removed


Set objArg = WScript.Arguments
AddIn_path = objArg(0)
AddIn_path = "C:\Program Files\FO PROD\SalesXL.xla"

strKeyPath = ""
oReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
    'msgbox subkey

strKeyPath = subkey & "\SOFTWARE\Microsoft\Office\11.0\Excel\Options"

oReg.EnumValues HKEY_USERS, strKeyPath,_
arrValueNames, arrValueTypes

X = """" & AddIn_path & """" 

For i=0 To UBound(arrValueNames)

oReg.GetStringValue HKEY_USERS,strKeyPath,arrValueNames(i),strValue

If (left(arrValueNames(i), 4) = "OPEN") Then
  If strValue = x  Then
oReg.DeleteValue HKEY_USERS,strKeyPath,arrValueNames(i)
'msgbox strKeyPath & "\" & arrValueNames(i)
End If
End If   

Next
Next

Set Excel Addin - VBScript

Following script can be used to set Excel Addin
Chabge Addin_Path value to the path of XLA file of Excel Addin that needs to be set



On Error resume next
Const HKEY_CURRENT_USER = &H80000001
const REG_SZ = 1
const REG_EXPAND_SZ = 2
const REG_BINARY = 3
const REG_DWORD = 4
const REG_MULTI_SZ = 7


Set objArg = WScript.Arguments
AddIn_path = objArg(0)
AddIn_path = "C:\Program Files\FO PROD\salesXL.xla"


strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Office\11.0\Excel\Options"
oReg.Createkey HKEY_CURRENT_USER,strKeyPath
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath,"EXAddin",1




oReg.EnumValues HKEY_CURRENT_USER, strKeyPath,_
 arrValueNames, arrValueTypes


n = 1
X = """" & AddIn_path & """" 
For i=0 To UBound(arrValueNames)


oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath,arrValueNames(i),strValue  

If (left(arrValueNames(i), 4) = "OPEN") Then
n = n +1    

If strValue = x  Then
'msgbox strValue
n = 0
Exit For
End If 
End If   


Next


If n <> 0 Then
n = n -1
If n = 0 Then
   
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath,"OPEN",x
Else 
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath,"OPEN" & n,x
End If 


End If 


Sunday, 15 July 2012

SUBINACL command to set File permission

Following is the command used to set Full Control permission to Users group


SUBINACL.EXE /file "C:\Program Files\VNDesktop\settings.xml" /grant=Users=F



Command to Register EXE

Command to register an executable 
MyFile.exe /REGSERVER


Command to Unregister an executable
MyFile.exe /UNREGSERVER



Command to register DLL using MSIEXEC


The following example shows how you can use the msiexec /y command:


msiexec /y my_file.dll


/y   Calls the system API DllRegisterServer to self-register modules passed on the command line.



The following example shows how you can use the msiexec /z command:


msiexec /z my_file.dll


/z   Calls the system API DllUnRegisterServer to unregister modules passed on the command line.

INSTALLLEVEL Property in MSI



Below are the list of features present in MSI and their Levels are highlighted


Now, Lets goto Property Table and locate property INSTALLLEVEL, its value is 100



We can disable a feature by changing its Level value higher than INSTALLLEVEL value.


In the following snapshot HPIO feature level is set to 110 and hence it is disabled.









Application Packaging Videos - AdminStudio Repackager