How do create service windows in configuration manager by using PowerShell.
Note about array in powershell. How to create empty arrays and a little trick for adding to arrays.
System Center Orchestrator 2012 Beta: Using Run .Net Script Activity – PowerShell: Inputting and Returning Data
This article describes how to use the Run .Net Activity to run PowerShell Scripts. I have created an example runbook which does the following: Start once every minute. Read a text file containing a list of sites/servers. Parse the list to PowerShell script. PowerShell script tried to ping each address and get the response time. PowerShell script output formatted HTML, ready to put inside a HTML Table, containing the addresses and response time. Runbook writes a web site based on a HTML template. The result is a website, in my case it looks like this: NB! some websites/server [...]
Run code when a new advertisement is created. This post contains a vbscript using async operations to catch the new advertisement, when it is created.
PowerShell: Creating new users from CSV with password and enabled accounts or How to Pipe into multiple cmdlets
How to create users from a CSV file, set their password and enable them in one command. This method shows you how to pipe the same output into multiple cmdlets by using the ForEach-Object Cmdlet.
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 [...]
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 [...]
Many people who have worked with PowerShell have reached this problem. You have a exe file in a folder that includes spaces. (fx. "C:\Program Files\") This exe file needs to be called with an argument that starts with "-". at the same time , you need to call it from another folder.
This post show how to do a list of all package structure in ConfigMgr 2007, via standard PowerShell.
“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 https://blog.ctglobalservices.com/jgs/outlook-2010-auto-export-body-of-new-e-mails/ he came up with a “How To” [...]
When I am developing new script, I usually use VBScript (or powershell but that’s another story). but sometimes I already have some old functions written in JScript, that I need to use in my VBScript. This article shows you how to do it.
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-5bcf9b99625b9640517031/] 5. Create rule in outlook 6. Select the coditions you want. Or none to process all [...]
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-5bcf9b996449b039181750/] Thanks to Jakob for providing me the code samples.
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-5bcf9b996526b030119035/] This file could be a shared file with all your common functions such as Log writer. Include-Example.Vbs [crayon-5bcf9b9965276535732380/] Then everytime you create a script you [...]
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-5bcf9b9965f2a518594770/] As you can see above i have used the IXmlSerialization interface, to define my custom serialization and deserialization [...]
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 [...]
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
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" [crayon-5bcf9b9966481979868192/]
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 [...]
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 [...]
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 [...]
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 [...]
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 [...]
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