[gptalk] Re: Scripting GPO

  • From: "Northwood, Ian" <Ian.Northwood@xxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Tue, 30 Oct 2007 15:30:36 -0000

OK, some good progress.
I've built a script-friendly ActiveX DLL to all MSI.DLL's exported functions. I 
haven't tested them all, mainly because I don't ever envisage using them, 
particularly as the majority are already exposed by the Windows Installer 
object. The one I was interested in, MsiAdvertiseProduct, works and 
successfully creates the (working) AAS file.
So, the next stage is to set the attributes for 'packageRegistration. Here's 
the code:
 With objPackageRegistration
  .Put "canonicalName", strDNSDomain & "/System/Policies/" & strGPOGUID & 
"/User/Class Store/Packages/" & strPackageGUID
  .Put "displayName", strProductName
  strTarget   = ""
  strTarget   = strTarget & "CN=" & strPackageGUID
  strTarget   = strTarget & ",CN=Packages"
  strTarget   = strTarget & ",CN=Class Store"
  If blnperUser Then
   strTarget  = strTarget & ",CN=User"
   strTarget  = strTarget & ",CN=Machine"
  End If
  strTarget   = strTarget & ",CN=" & strGPOGUID
  strTarget   = strTarget & ",CN=Policies"
  strTarget   = strTarget & ",CN=System"
  strTarget   = strTarget & "," & strDomain
  .Put "distinguishedName", strTarget   
  .Put "fromEntry", True
  .Put "installUILevel", 3
  .Put "instanceType", 4  
  .Put "localeID", CInt(strProductLanguage)
  .Put "machineArchitecture", 1282  
  strTarget   = ""
  strTarget   = strTarget & "0:" & strMSIFolder & "\" & strMSI
  If Len(strMST) > 0 Then
   strTarget  = strTarget & Chr(0) & "1:" & strMSIFolder & "\" & strMSI
  End If
  .Put "msiFileList", strTarget
  .Put "msiScriptName", "A"
  .Put "msiScriptPath", strAASFile
  .Put "packageFlags", -1609943952
  .Put "packageName", strProductName 
  .Put "packageType", 5 
  .Put "productCode", arrProductCodeOctet '// Product Code as an octet string
  .Put "revision", 0
  .Put "sDRightsEffective", 7
  .Put "showInAdvancedViewOnly", True 
  .Put "subSchemaSubEntry", "CN=Aggregate,CN=Schema,CN=Conifoguration,DC=" & 
  .Put "upgradeProductCode", arrUpgradeCodeOctet '// Upgrade Code as an octet 
  .Put "versionNumberHi", strProductVersionHi
  .Put "versionNumberLo", strProductVersionLo
 End With
I have walked through each .Put in a script debugger and none returns an error 
but as soon as .SetInfo is executed, Err.Number is (equivalent to) 8007200C 
which my error library tells me is LDAP_UNDEFINED_TYPE 
Above, where you see variables prefixed with 'str', these are strings which 
have been created externally to this code. I have ensured that octet strings 
are being passed as byte arrays and all other data types are correct, too. Can 
anyone tells me what's causing this error?

Liverpool Victoria Friendly Society Ltd. Registered in England and Wales. 
Registered Office: County Gates Bournemouth England, BH1 2NF, No.61 Coll. 
Financial Services Authority Register number 110035.

This email (and any attachments):

- is for its intended recipients only and may contain confidential and/or 
legally privileged information. If received in error, any use of this email is 
Please delete it (and any copies) and notify us on +44(0)1202 292333, ext. 

-  is believed to be free of any virus or other defect but internet 
communications cannot be guaranteed to be secure or error free and we do not 
accept any liability for any loss or damage from their receipt or use.  
Opinions expressed in this email are not necessarily those of the Society. 

LV= and Liverpool Victoria are trade marks of Liverpool Victoria Friendly 
Society Limited and LV= and LV= Liverpool Victoria are trading styles of the 
Liverpool Victoria group of companies. 
LV= reserves the right to monitor and inspect emails sent to and by its 
employees.  To find out more about us please visit: www.lv.com

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 

Other related posts: