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: $SecDesc = ([WMIClass] "\\$ComputerName\root\cimv2:Win32_SecurityDescriptor").CreateInstance() 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: ' Create and populate a [...]

By |2011-09-27T10:22:30+01:00september 27th, 2011|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til WMI/ConfigMgr Scripting: CreateEmbeddedObjectInstance (.NET) or SpawnInstance (VBScript) in PowerShell

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

[download id="41"] 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 [...]

By |2011-05-31T16:02:37+01:00maj 31st, 2011|Configuration Manager (SCCM), Scripting & Development|Kommentarer lukket til Adding users to Configuration Manager 2007 with specific Class Permissions via VBScript

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. Sub SaveMessageOnRule(Item As Outlook.MailItem) Dim strExportPath As String strExportPath = "C:\Temp\Mails\" Dim FileName As String FileName = [...]

By |2017-08-21T21:17:06+01:00marts 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: Sub WriteLog(strMessage) Const FOR_APPENDING = 8 strFileName = "C:\test.txt" Set objFS = CreateObject("Scripting.FileSystemObject") If objFS.FileExists(strFileName) Then Set oFile = objFS.OpenTextFile(strFileName, FOR_APPENDING) Else Set oFile = objFS.CreateTextFile(strFileName) [...]

By |2010-12-17T14:36:03+01:00december 17th, 2010|Scripting & Development|5 Comments

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

[download id="19"] 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: https://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" ' //*************************************************************************** ' //*************************************************************************** ' // ***** Script Header ***** ' // ' // Solution: ConfigMgr [...]

By |2010-03-17T16:30:33+01:00marts 17th, 2010|Scripting & Development|75 Comments

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

Download: [download id="13"] 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: [download#4#size#nohits] 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 membership [...]

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

Automated Windows Installer Properties from .INI (Embedded VBScript)

Download: [download#2#size#nohits] 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 the [...]