WMI/ConfigMgr Scripting: CreateEmbeddedObjectInstance (.NET) or SpawnInstance (VBScript) in PowerShell

  During the development of the script I posted yesterday, I noticed that a lot of people had problem discovering how to create WMI objects in PowerShell. I found different suggestions, but they all had problems. When I have to create WMI object instances I use this this method, which I used in my old script about sharing folders here is an example: [crayon-5a1265b446b90419397129/] using configuration manager development we have to create a lot of wmi objects. Take a look at this SDK Sample in the VBScript example we have this line: [crayon-5a1265b446b99234373325/]   and in the C# example it [...]

Adding users to Configuration Manager 2007 with specific Class Permissions via VBScript

The Configuration Manager 2007 SDK, has a lot of missing examples and parts that are not well documented. One of them is the part about User permissions and how to add them. During the development of the install script for our HTA solution, I had to create a HTA user, with special permissions for the different classes on the site server. I create function called "SetConfigMgrPermission" for this specific purpose. It is actually a quite simple function. I requires: Connection: this is a standard configmgr connection, created by the connect function from the SDK. The downloadable script contains [...]

Outlook 2010: Auto Export Body of new e-mails

This macro is made for a opsmgr management pack, soon to be published on this blog. It is written in VBA in outlook 2010 (could work in other version too, but it is not tested). It shows how to create a macro function, that is usable in a rule. 1. Enable Developer Ribbon to be able to create scripts 2. Open visual Basic 3. Select “ThisOutlookSession” 4. Type/ this Sub into Visual Basic. Changed the strExportPath to the folder you want to use. [crayon-5a1265b4484bb603284713/] 5. Create rule in outlook 6. Select the coditions you want. Or none to process all [...]

By | 2017-08-21T21:17:06+00:00 March 28th, 2011|Scripting & Development|10 Comments

Include other files in VBScript

Have you ever wanted to include another .vbs file with all your common functions in a script? Many people I have met thought it wasn’t possible. But it is actually pretty easy to do with “ExecuteGlobal” to make it even easier, I have created a small function which you can put in your scripts and use a simple Include("C:\functions.vbs") I have made 2 small example scripts to show you how to use it: Functions.vbs: [crayon-5a1265b4496c6717111097/] This file could be a shared file with all your common functions such as Log writer. Include-Example.Vbs [crayon-5a1265b4496d3173526308/] Then everytime you create a script you [...]

By | 2010-12-17T14:36:03+00:00 December 17th, 2010|Scripting & Development|4 Comments

VBScript: Move computer object to another OU via Command line parameter

UPDATE: New improved script 0.0.3 uploaded. Thanks to Nico_ at Technet Forums! Hello everyone My collegue Michael Petersen, needed a script to move computers to another OU, after re-installing them via SCCM/ConfigMgr. He have written a blog post to show how to use it in a Task Sequence: http://blog.ctglobalservices.com/mip/using-ts-variables-when-running-a-script-under-a-different-account/ therefore i developed this small script All you needs to do is to run it with the CN for the new OU (without the LDAP://) in the commandline like this: cscript.exe MoveOU.vbs "OU=HQ,dc=woodgrovebank,dc=com" [crayon-5a1265b44a48d919728899/]

By | 2010-03-17T16:30:33+00:00 March 17th, 2010|Scripting & Development|67 Comments

OpsMgr 2007 (SCOM): Coretech Certificates Expire checker Management Pack – 0.0.0.1

Download: Intro: This management packs can be used to check the expire date on all or specific certificates in the client/servers certificates store. It uses the event log on the local client, to alert the OpsMgr unit monitor . It is supposed to check once every day, and make a warning in the opsmgr if any certificates are close to the expire date. This is the very first version. It has been tested in my test environments, and will soon be tested in production. Please do not hesitate to report any bugs and please send suggestions for the [...]

Checking if User is member of group including nested/sub groups!

Download: I had a challenge today. Problem: My Customer needs to insert a specific text in the Computer description field on the local PC, if the user is member of a specific group. Challenges: The problem is that most of the user are not directly members of the group. but they are members of a nested group that if member of the group, or a nested group , that is member of a nested group , that is member of the group and so on. This gave me a problem, since the usual way of checking the user [...]

By | 2008-12-01T12:41:43+00:00 December 1st, 2008|Scripting & Development|8 Comments

Automated Windows Installer Properties from .INI (Embedded VBScript)

Download: Have you ever needed the functionality to read the property values from an .ini file, every time a installation or repair is run? This small script created for Windows installer, will do the job. Purpose:   Automatically reads a ini file located in the MSI SOURCEDIR property. Each parameter in the ini file is read into the property that have the same name. ex. "DaysSerial"="0100000" line is read in to property named DaysSerial and setting the value to 0100000 System works both with "DaysSerial"="0100000" ini format, or DaysSerial=0100000 ini format. If you later change the ini file at [...]