[gptalk] Add MSI package to GP

  • From: "Northwood, Ian" <Ian.Northwood@xxxxxx>
  • To: <gptalk@xxxxxxxxxxxxx>
  • Date: Wed, 26 Sep 2007 12:55:35 +0100

I'm writing a script (VBScript) to automate as much as possible of our
'preparation for deployment' process, mostly so we can impose standards
and stop packagers using ridiculous names for GPOs! 
So far, the script creates the group, sets up the GPO, links the GPO to
the relevant OU, removes 'Authenticated Users' from the permission list
and adds the group created in the first step. That all works.
Now, I need ti make it add the MSI to the GPO. Does anyone have any
pointers about this? I've looked at the GPMgmt.GPM object docs on MSDN
but that doesn't seem to have anything which looks like it might do the
I imagine I'd need to use the GPO's GUID (which the script stores
already) somewhere but what do I do with it? Do I have to add every
property that I can see in ADSIEdit? Surely not? There must be an 'Add'
method or something somewhere...
I have the shell of a function which looks like this:
Function AddPackageToGPO(ByVal strDomain, ByVal strGUID, ByVal
 Dim strTarget
 strTarget    = "CN=Packages,CN=Class Store""
 If blnPerUser Then
  strTarget   = strTarget & ",CN=User"
  strTarget   = strTarget & ",CN=Machine"
 End If
 strTarget    = strTarget & ",CN=" & strGUID & ",CN=Policies,CN=System,"
& strDomain
 AddPackageToGPO    = False
 AddPackageToGPO    = True
End Function
All I need is the rest! :) Can this even be done in script? I can't
believe it can't be...

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: