Pages

Friday, 3 August 2012

Transitive components - MSI


Transitive components are regular components that are arranged in mutually-exclusive groups. The simplest example of a transitive component is a library that has different versions for Windows 95 and Windows NT. When you install the product, it installs either the Windows 95 or the Windows NT version, depending on the current operating system, but not both.

What are Secure Transforms


Secure transforms are simply transforms that are kept in a place where the user does not have write access. This might be the root of the location where an administrative installation of the package has been performed (Secure-at-Source transforms). It might also be a share or full path elsewhere on the network (Secure-Full-Path transforms).


You can indicate that the Installer should use secure transforms by special
characters in the TRANSFORMS property (discussed in the next section) or by setting the TransformsSecure or TransformsAtSource properties within the Installer database to 1.


When the Installer uses a secure transform, it will cache a copy of that transform locally. If the local copy becomes lost or damaged, it will restore it only from the original location.


Check if a Machine is Laptop - VBScript




dim l_objService
dim l_objEnum
dim l_boolIsLaptopNotebookOrTablet : l_boolIsLaptopNotebookOrTablet = false


set l_objService = getObject("winmgmts:root\cimv2")
set l_objEnum = l_objService.ExecQuery("select __relpath, chassisTypes from Win32_SystemEnclosure")


for each l_objChassis in l_objEnum


if IsArray(l_objChassis.ChassisTypes) then
for l_intItem = lbound(l_objChassis.ChassisTypes) to ubound(l_objChassis.ChassisTypes)
l_intType = l_objChassis.ChassisTypes(l_intItem)
if l_intType = 8 or l_intType = 9 or l_intType = 10 then
l_boolIsLaptopNotebookOrTablet = true
msgbox l_boolIsLaptopNotebookOrTablet
end if
next
end if
next


if IsObject(l_objService) then
set l_objService = nothing
end if


if l_boolIsLaptopNotebookOrTablet = true then
wscript.quit 1
else
wscript.quit 0 ' not a computer system that we are concerned about in this package
end if


Append Binary value in Registry - VBScript




const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SOFTWARE\Microsoft\Driver Signing"
strComputer = "."
iValues = Array(&H00,&H00,&H00,&H00)
Set oReg=GetObject( _ 
    "winmgmts:{impersonationLevel=impersonate}!\\" & _
   strComputer & "\root\default:StdRegProv")
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strKeyPath = "SOFTWARE\Microsoft\Driver Signing"
BinaryValueName = "Policy"


oReg.SetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_
    BinaryValueName,iValues
Set oReg = Nothing

Thursday, 2 August 2012

Get Network Adaptor Speed - VBSCript


strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI") 
Set colItems = objWMIService.ExecQuery("SELECT * FROM MSNdis_LinkSpeed",,48) 
For Each objItem in colItems 
    Wscript.Echo "InstanceName: " & objItem.InstanceName
    Wscript.Echo "NdisLinkSpeed: " & objItem.NdisLinkSpeed/10000 & " mbps"
Next


Copying a Set of Files - VBScript



Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\FSO\*.txt" , "D:\Archive\" , OverwriteExisting

Read Registry - VBScript


Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\./root/default:StdRegProv")
sBaseKey = "SOFTWARE\"
iRC = oRegistry.EnumKey(&H80000001, sBaseKey, arSubKeys)
For Each sKey In arSubKeys

if skey="JNJ" then
msgbox "yes"
end if
next