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 [...]

VBScript: Cleanup all computer objects for local PC

When we are deploying OS via ConfigMgr, we usually do a cleanup of all old objects before creating the new object. This helps prevent errors and mistakes, and is pretty easy to do. We are able to use both SMBOIS GUID and Mac addresses for the cleanup. usually I recommend using mac addresses, since I have experienced that laptops who have had their mainboard exchanged, have the BIOS GUID of "0000-00000-0000-0000", this happens because the repair shop forgets to write in the GUID after the repair. The mac addresses are always usable , since they are not typed [...]

“How to Raise Alert from Microsoft Outlook in OpsMgr 2007” or a New Outlook Connector to Operations Manager 2007 R2

Have you ever thought on creating Alerts directly from a mail? Or Send a mail to your OpsMgr to raise an alert in your Operations Manager? A few weeks ago I was talking with a guy participating on one of the Advanced OpsMgr courses, his existing monitoring environment currently delivered an mail to a group mailbox in which they used to react and resolve issues from a Nagios/IPMonitor installation. But what he really would like to was gather all issues in the Operation Manager Console, after a quick talk with Jakob Svendsen http://blog.ctglobalservices.com/jgs/outlook-2010-auto-export-body-of-new-e-mails/ he came up with a “How To” [...]

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-5a0f627ee7871923967013/] 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

Add AD user accounts to the SBS Console

When you create AD user accounts through Active Directory Users and Computers, they don’t appear in the SBS Console. And therefore it is not possible to manage them from the Console. Run this VB script to add user accounts to the SBS console. Be sure to define the OU location for your users before running the script. The script don't add disabled accounts. [crayon-5a0f627ee88f7295934962/] Thanks to Jakob for providing me the code samples.

By | 2011-01-27T13:52:01+00:00 January 27th, 2011|Scripting & Development|5 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-5a0f627ee9508225753472/] This file could be a shared file with all your common functions such as Log writer. Include-Example.Vbs [crayon-5a0f627ee9511968633016/] Then everytime you create a script you [...]

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

Serializing System.Net.IPAddress to XML

  Working on a project today, i needed to serialize one of my classes that included at System.Net.IPAddress property. Problem problem is that IPAddress does not support XML Serialization since it does not implement a parameterless constructor! I tried to search the net, but couldnt find a complete guide, therefore i am posting this, hoping to help others in the same situation! My solution is to serialize the IPAddresses as a string, and later parse them top ip adresses again. [crayon-5a0f627eea112443463244/]   As you can see above i have used the IXmlSerialization interface, to define my custom serialization and deserialization [...]

By | 2010-06-22T12:01:29+00:00 June 22nd, 2010|Scripting & Development|0 Comments

Microsoft Scripting Games 2010

  It is almost time for the annual Scripting Games at Microsoft Scripting Guys! Scripting games is a fun “competition” with a lot of different scripting challenges. This year it is held from April, 26 – May 7. I suggest all scripters to join the fun!, it is good practice for both newcomers and hardcore scripting guys!, since there is both a basic and advanced part of the challenges! All challenges can be solved in VBScript or Powershell. This year i have been selected to make one of the expert solutions, so check out my solution at VBScript: Advanced event [...]

By | 2010-04-20T12:50:29+00:00 April 20th, 2010|Powershell, Scripting & Development|0 Comments

.NET Links and Books (2956B/2957B)

Exam: 70-536: http://www.microsoft.com/learning/en/us/Exam.aspx?ID=70-536&Locale=en-us Second shot (valid until June 30, 2010): http://www.prometric.com/Microsoft/SS_MCP_form.htm?s=ssm MOC 2956B: Delegates and Events in C# / .NET http://www.akadia.com/services/dotnet_delegates_and_events.html DotNetZip - Zip Class Library http://dotnetzip.codeplex.com/ Prefix-casting versus as-casting in C#: http://gen5.info/q/2008/06/13/prefix-casting-versus-as-casting-in-c/ MOC 2957B: Hatchbrush shapes: http://www.java2s.com/Tutorial/CSharp/0480__2D/HatchBrushStyle.htm Manual Double buffering: http://www.bobpowell.net/doublebuffer.htm String Format 101: http://blogs.msdn.com/kathykam/archive/2006/03/29/564426.aspx Regex Lib: http://www.regexlib.com RegexBuddy: http://www.regexbuddy.com/ Service Custom Commands http://arcanecode.com/2007/05/30/windows-services-in-c-sending-commands-to-your-windows-service-part-7/ IPC Channel communication http://www.codeguru.com/csharp/csharp/cs_syntax/remoting/article.php/c9251 Automation Compatible Types: (not complete) http://dragona79.springnote.com/pages/97595 Other: From WinForm to WPF: A Quick Reference guide http://www.simple-talk.com/dotnet/.net-framework/from-winform-to-wpf-a-quick-reference-guide/ ReSharper http://www.jetbrains.com/resharper/buy/index.jsp

By | 2010-03-29T10:19:11+00:00 March 29th, 2010|Scripting & Development|6 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-5a0f627eea5c6340577671/]

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

Automate your group creation with Powershell

One of our very good customers are managing servers with an dedicated internal administrator as a primary contact for each server. They are managing this one to one relation with an Excel sheet. A while ago we talked about automating this group creation with powershell, so the last time Jacob and I was discussing Powershell in Operations Manager we found a solution - Jacob who is the best Danish Powershell Guru of cause did a superoptimization of my first script and now its up to you to test it on your own. Please change the first lines of the script to [...]

MOC Lab Launcher Fixer for Windows 7

Windows 7 has arrived, and everything is fine! We only have one problem. Many of the MOC Course Material is using the "Lab Launcher". The MSI for the "Lab Launcher" is not supported by Windows 7. To Fix this problem a Hack/Edit of the MSI is needed. Read this blog post for info about how to do it manually: http://tfl09.blogspot.com/2009/08/windows-7-and-virtual-server.html Big Thanks to Thomas Lee for the great tutorial!   I am facing the same problem as him a lot these days, and i usually did the Edit manually. Therefore i decided to make a small utility that [...]

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 [...]

Powershell – WMI: Working with Shares – Part 1: Creating a Share with Custom Permissions

Download Script: Intro: Last week, i was teaching a Powershell course (MOC6434), when a student asked me, how to create a share with custom permissions via WMI. I tried to find an answer for him, but could not really find any examples, cmdlets or functions for it. I found some examples and help in vbscript, so i decided to make some powershell functions of my own. I Created these functions that uses the Win32_Share class of WMI. They support remote creation and multiple permissions. New-Share is for creating a share. New-ACE is for creating one or more ACEs [...]

Add Custom Data Type / Structure to My.Settings in VB.NET / WPF

During the work of a new Coretech SCCM Manager GUI in WPF, i ran in to some problems with My.Settings. I have used My.Settings for all settings in the Utility, and are using my own structures for the combo-box value and others. The problem is that i could not create a setting, that contained my own structure instead of a system data type. I simply could not select it in the list: I tried to use the browse function, but no luck. I have searched the net for ages, trying to find a solution, but never found one. This problem [...]

By | 2009-03-05T16:15:14+00:00 March 5th, 2009|Scripting & Development|19 Comments

Find Query-based Distribution Groups in Domain

To find all QBD groups in your domain run the following. (Remember to change the LDAP string...) On Error Resume Next Const ADS_SCOPE_SUBTREE = 2 Set objConnection = CreateObject("ADODB.Connection") Set objCommand =   CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection objCommand.Properties("Page Size") = 1000 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.CommandText = _     "SELECT cn, objectClass FROM 'LDAP://dc=coretech,dc=intra' WHERE " _         & "objectClass ='msExchDynamicDistributionList'" Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF    Wscript.Echo objRecordSet.Fields(1).Value    objRecordSet.MoveNext Loop

By | 2009-02-10T17:17:15+00:00 February 10th, 2009|Scripting & Development|3 Comments

Useful Links, Editors and Books for Visual Basic, Scripting Edition (VBScript)

Here is a list of links, editors and books. I have mentioned some of them, in the Visual Basic, Scripting Edition Course (MOC 2433). Links: Microsoft Script Center: http://www.microsoft.com/technet/scriptcenter/default.mspx VBScript Introduction http://wiht.link/vbscript-resources VBScript Language Reference: http://msdn.microsoft.com/en-us/library/d1wf56tt.aspx Microsoft Scripting Guys! Forum - Technet: http://social.technet.microsoft.com/Forums/en-US/ITCG/threads/ w3Schools - VBScript Section: http://w3schools.com/vbscript/default.asp SCCM and other Scripts: http://myitforum.com/cs2/blogs/dhite/ UAC and VBSCript: http://www.winhelponline.com/articles/185/1/VBScripts-and-UAC-elevation.html Naming Conventions for Visual Basic: http://support.microsoft.com/kb/110264 Scripting Guy’s Determine Last Logon time: http://technet.microsoft.com/da-dk/magazine/2006.01.scriptingguy(en-us).aspx Encode a Script – Sample: http://www.microsoft.com/technet/scriptcenter/csc/scripts/security/scripts/cscse001.mspx Scripting Games  - Don't Worry, Get SAPI: Using the Speech API to Add Voice and Sound Effects to a Script http://www.microsoft.com/technet/scriptcenter/funzone/games/sapi.mspx COM Authenticating Level [...]

By | 2009-01-14T12:17:18+00:00 January 14th, 2009|Scripting & Development|1 Comment

Usefull Powershell Links and Books.

Links: Microsoft Scripting guys! Forum: Usually you will get very quick replys and help in there http://social.technet.microsoft.com/Forums/en/ITCG/threads Powershell 2.0 and others for All Windows (Windows Management Framework) http://support.microsoft.com/default.aspx/kb/968929 Writing Help for Windows Modules http://msdn.microsoft.com/en-us/library/windows/desktop/dd878343(v=vs.85).aspx Importing / Exporting Credentials in Powershell (Manually create Credential object) http://www.leeholmes.com/blog/ImportingAndExportingCredentialsInPowerShell.aspx Working wth ODBC: http://theessentialexchange.com/blogs/michael/archive/2008/01/07/multi-platform-database-access-with-powershell.aspx Create Custom Inputbox: http://www.microsoft.com/technet/scriptcenter/resources/pstips/feb08/pstip0208.mspx Working with Arrays: http://powershell.com/cs/blogs/tips/archive/2008/11/19/working-with-arrays.aspx Change Error Message Colors: http://www.microsoft.com/technet/scriptcenter/resources/pstips/aug07/pstip0817.mspx PowerBoots - Interface for creating WPF GUI's in powershell http://huddledmasses.org/powerboots-tutorial-walkthrough/ Powershell SDK: http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en Free PowerShell Commands for Active Directory http://www.quest.com/powershell/activeroles-server.aspx Blog: ADPowershell: http://blogs.msdn.com/adpowershell/ Outputting Calculated Coloumns in Powershell: http://powershell.com/cs/blogs/tips/archive/2008/11/21/outputting-calculated-properties.aspx The Scripting Guys: How does the RemoteSigned execution policy [...]

By | 2009-01-09T17:22:40+00:00 January 9th, 2009|Powershell, Scripting & Development|1 Comment

Notepad++

Download: http://sourceforge.net/projects/notepad-plus/ System Requirements: All Windows OS Licence: Free Developer: Sourceforge.net (multiple developers) Info: http://notepad-plus.sourceforge.net/uk/site.htm   Short Description: Replacement for Notepad, that gives you collar coding, and lots of other useful stuff for editing a variety of script languages. Personally I use for editing XML, VBS and WSF files..

By | 2008-12-12T15:17:00+00:00 December 12th, 2008|Scripting & Development|0 Comments

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