<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>snowland.se &#187; VBScript</title>
	<atom:link href="http://www.snowland.se/category/vbscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.snowland.se</link>
	<description>Rikard Rönnkvist blogging about Microsoft System Center and other management stuff...</description>
	<lastBuildDate>Mon, 23 Aug 2010 11:19:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Outlook and meeting reminders</title>
		<link>http://www.snowland.se/2009/09/27/outlook-and-meeting-reminders/</link>
		<comments>http://www.snowland.se/2009/09/27/outlook-and-meeting-reminders/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 05:52:41 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[Good-to-have]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Outlook]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=371</guid>
		<description><![CDATA[I do not like the fact that the person sending a meeting request is the one deciding how long before the meeting a reminder would be set.
Since I don&#8217;t like the popup on my phone, I&#8217;m not using reminders.
So to get rid of incoming reminders I wrote a small script.
Press ALT+F11 and paste this code:

Sub [...]]]></description>
			<content:encoded><![CDATA[<p>I do not like the fact that the person sending a meeting request is the one deciding how long before the meeting a reminder would be set.</p>
<p>Since I don&#8217;t like the popup on my phone, I&#8217;m not using reminders.</p>
<p>So to get rid of incoming reminders I wrote a small script.</p>
<p>Press ALT+F11 and paste this code:</p>
<pre class="brush: vb;">
Sub snwRemoveMeetingReminder(Item As Outlook.MeetingItem)
    If TypeOf Item Is Outlook.MeetingItem Then
        Item.ReminderSet = False
        Item.Save

        Set Appt = Item.GetAssociatedAppointment(True)
        If Not Appt Is Nothing Then
            Appt.ReminderSet = False
            Appt.Save
        End If
    End If
End Sub
</pre>
<p>Then add the the script to incoming meeting requests.<br />
<img src="http://www.snowland.se/wp/wp-content/uploads/090927_outlook_rule.png" alt="090927_outlook_rule" title="090927_outlook_rule" class="alignnone size-full wp-image-372" /></p>
<p>Now the script will remove reminders on every incoming meeting request&#8230; It&#8217;s a client side rule, so you need to have Outlook running to get it to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/09/27/outlook-and-meeting-reminders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitor connected consoles</title>
		<link>http://www.snowland.se/2009/06/08/monitor-connected-consoles/</link>
		<comments>http://www.snowland.se/2009/06/08/monitor-connected-consoles/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 08:35:28 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[OpsMgr]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Connected]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[Monitor]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=301</guid>
		<description><![CDATA[A small and simple script to monitor number of connected SCOM-consoles.

Set oLocator = CreateObject(&#34;WbemScripting.SWbemLocator&#34;)
Set oWmi = oLocator.ConnectServer(&#34;.&#34;, &#34;root/snmp/localhost&#34;, &#34;&#34;)
Set oStats = oWmi.ExecQuery(&#34;select * from SNMP_RFC1213_MIB_tcpConnTable where tcpConnLocalPort = 5724 AND tcpConnLocalAddress &#60;&#62; '0.0.0.0' AND tcpConnLocalAddress &#60;&#62; '127.0.0.1'&#34;)

Set oAPI = CreateObject(&#34;MOM.ScriptAPI&#34;)
Set oBag = oAPI.CreatePropertyBag()
oBag.AddValue &#34;ConnectedConsoles&#34;, oStats.Count
oAPI.AddItem(oBag)
oAPI.ReturnItems

]]></description>
			<content:encoded><![CDATA[<p>A small and simple script to monitor number of connected SCOM-consoles.</p>
<pre class="brush: vb;">
Set oLocator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;)
Set oWmi = oLocator.ConnectServer(&quot;.&quot;, &quot;root/snmp/localhost&quot;, &quot;&quot;)
Set oStats = oWmi.ExecQuery(&quot;select * from SNMP_RFC1213_MIB_tcpConnTable where tcpConnLocalPort = 5724 AND tcpConnLocalAddress &lt;&gt; '0.0.0.0' AND tcpConnLocalAddress &lt;&gt; '127.0.0.1'&quot;)

Set oAPI = CreateObject(&quot;MOM.ScriptAPI&quot;)
Set oBag = oAPI.CreatePropertyBag()
oBag.AddValue &quot;ConnectedConsoles&quot;, oStats.Count
oAPI.AddItem(oBag)
oAPI.ReturnItems
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/06/08/monitor-connected-consoles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCCM Console Extensions &#8211; Parameters</title>
		<link>http://www.snowland.se/2009/05/06/sccm-console-extensions-parameters/</link>
		<comments>http://www.snowland.se/2009/05/06/sccm-console-extensions-parameters/#comments</comments>
		<pubDate>Wed, 06 May 2009 13:01:47 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[ConfigMgr]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[GUID]]></category>
		<category><![CDATA[SUB]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=282</guid>
		<description><![CDATA[OK, so now you know the GUID for the right-click tool&#8230; but what about passing parameters?
There are a few standard SUB&#8217;s (parameters) that you can use, some are listed in this post: http://www.snowland.se/2008/05/28/sccm-console-extensions/
But if you take the example of GUID 5fb29b42-5d11-4642-a6c9-24881a7d317e that you can find under Software Distribution Packages / Packages / Some package / [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so now you know the GUID for the right-click tool&#8230; but what about passing parameters?</p>
<p>There are a few standard SUB&#8217;s (parameters) that you can use, some are listed in this post: <a href="http://www.snowland.se/2008/05/28/sccm-console-extensions/">http://www.snowland.se/2008/05/28/sccm-console-extensions/</a></p>
<p>But if you take the example of GUID 5fb29b42-5d11-4642-a6c9-24881a7d317e that you can find under Software Distribution Packages / Packages / Some package / Package Status / Site Server / Right click on a distribution point</p>
<p>Say that you want to pass the server-name or the path to the package&#8230;</p>
<p>First off, open the <stron>E:\Program Files\Microsoft Configuration Manager\AdminUI\XmlStorage\ConsoleRoot\AdminConsole.xml</strong> in some editor.</p>
<p>Then search for the GUID and you will find something like this.</p>
<pre class="brush: xml;">
&lt;NodeDescriptions&gt;
  &lt;ResultPaneItemDescriptions&gt;
    &lt;ResultPaneItemDescription NamespaceGuid=&quot;5fb29b42-5d11-4642-a6c9-24881a7d317e&quot; DesignerName=&quot;Localize:Status scoped result panel definitioN&quot;&gt;
      &lt;Queries&gt;
        &lt;QueryDescription NamespaceGuid=&quot;54d25192-0e7a-47b2-a6f2-67ff764d41c6&quot; Type=&quot;WQL&quot; HelpTopic=&quot;e63a41d2-a2c2-4a52-bfbb-67dc0bd7b429&quot;&gt;
          &lt;SupportedTypes&gt;
            &lt;string&gt;SMS_PackageStatusDetailSummarizer&lt;/string&gt;
          &lt;/SupportedTypes&gt;
          &lt;Query&gt;SELECT * FROM SMS_PackageStatusDistPointsSummarizer WHERE PackageID='##SUB:PackageID##' AND SiteCode='##SUB:SiteCode##'&lt;/Query&gt;
          &lt;ReturnedClassType&gt;SMS_PackageStatusDistPointsSummarizer&lt;/ReturnedClassType&gt;
        &lt;/QueryDescription&gt;
      &lt;/Queries&gt;
    &lt;/ResultPaneItemDescription&gt;
  &lt;/ResultPaneItemDescriptions&gt;
&lt;/NodeDescriptions&gt;
</pre>
<p>A few lines below the GUID you find <strong><Query>SELECT * FROM SMS_PackageStatusDistPointsSummarizer WHERE Packa&#8230;</strong> Copy that line and replace/clean it up so that it is a valid WMI-query.<br />
Will look something like:</p>
<pre class="brush: sql;">
SELECT * FROM SMS_PackageStatusDistPointsSummarizer WHERE PackageID='XYZ00123' AND SiteCode='XYZ'
</pre>
<p>Next step is to start some WMI-browser and connect to <strong>root\SMS\site_XYZ</strong> and run the query and take a look at the columns.<br />
(I like to use <a href="http://www.ks-soft.net/hostmon.eng/wmi/index.htm">WMI Explorer</a>)</p>
<p>In the query above you will have columns like ServerNALPath, SourceNALPath, SourceVersion this is what you are looking for. <img src='http://www.snowland.se/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Use them in your extensions like this:</p>
<pre class="brush: xml;">
&lt;Executable&gt;
	&lt;FilePath&gt;myScript.vbs&lt;/FilePath&gt;
	&lt;Parameters&gt;##SUB:ServerNALPath## ##SUB:SourceNALPath## ##SUB:SourceVersion##&lt;/Parameters&gt;
&lt;/Executable&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/05/06/sccm-console-extensions-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SCCM Console Extensions &#8211; Find the GUID</title>
		<link>http://www.snowland.se/2009/05/06/sccm-console-extensions-find-the-guid/</link>
		<comments>http://www.snowland.se/2009/05/06/sccm-console-extensions-find-the-guid/#comments</comments>
		<pubDate>Wed, 06 May 2009 12:41:12 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[ConfigMgr]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Console]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[GUID]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=278</guid>
		<description><![CDATA[I wrote some about this topic in a post a while ago&#8230; did some more scripting around this today.
This VBScript will read the AdminConsole.xml and look for NameSpaceGuid&#8217;s, when it find one it will create a subdirectory (from where it is started) with the GUID and after that it will create a XML-file within that [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote some about this topic in <a href="http://www.snowland.se/2008/05/28/sccm-console-extensions/">a post</a> a while ago&#8230; did some more scripting around this today.</p>
<p>This VBScript will read the AdminConsole.xml and look for NameSpaceGuid&#8217;s, when it find one it will create a subdirectory (from where it is started) with the GUID and after that it will create a XML-file within that directory.<br />
The XML-file then points to an VBS-file with a couple of parameters. (Look further down for an example of a nice VBScript to use)</p>
<p><strong>Tip:</strong> Backup AdminUI\XmlStorage\Extensions\Actions before you start to play around with this.</p>
<pre class="brush: vb;">
Const cVbsFile = &quot;testExtension.vbs&quot; ' The file to call on right-click
Const cHKEY_LOCAL_MACHINE = &amp;H80000002
Set oReg=GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv&quot;)
oReg.GetStringValue cHKEY_LOCAL_MACHINE,&quot;SOFTWARE\Microsoft\ConfigMgr\Setup&quot;, &quot;UI Installation Directory&quot;, sSccmPath
Set oReg = Nothing

sSourcePath = Replace(WScript.ScriptFullName, WScript.ScriptName, &quot;&quot;)

Set oShell = CreateObject(&quot;WScript.Shell&quot;)
Set oFso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set oFile = oFso.OpenTextFile(sSccmPath &amp; &quot;\XmlStorage\ConsoleRoot\AdminConsole.xml&quot;, 1)
Do While oFile.AtEndOfStream &lt;&gt; True
    sText = Trim(uCase(oFile.ReadLine))
    If InStr(sText, &quot;NAMESPACEGUID=&quot;) Then

		' Read the GUID from NameSpaceGuid param
		sGuid = sText
		sGuid = Right(sGuid, Len(sGuid) - InStr(sGuid, &quot;NAMESPACEGUID=&quot;) - 14)
		sGuid = Left(sGuid, InStr(sGuid, &quot;&quot;&quot;&quot;)-1)

		if not oFso.FolderExists(sSourcePath &amp; sGuid) Then
			WScript.Echo sSourcePath &amp; sGuid

			' Create the GUID folder
			oFso.CreateFolder sSourcePath &amp; sGuid

			' Create the XML-file with current Guid, Name &amp; ResourceID as parameter to source-VBScript
			Set oXmlFile = oFso.CreateTextFile(oShell.ExpandEnvironmentStrings(&quot;%TEMP%\snowland-guid-locator.xml&quot;), True)
			oXmlFile.WriteLine &quot;&lt;ActionDescription Class=&quot;&quot;Executable&quot;&quot; DisplayName=&quot;&quot;GUID - &quot; &amp; sGuid &amp; &quot;&quot;&quot; MnemonicDisplayName=&quot;&quot;GUID locator&quot;&quot; Description=&quot;&quot;snowland.se GUID locator&quot;&quot;&gt;&quot;
			oXmlFile.WriteLine &quot;&lt;Executable&gt;&quot;
			oXmlFile.WriteLine &quot;&lt;FilePath&gt;&quot; &amp; sSourcePath &amp; cVbsFile &amp; &quot;&lt;/FilePath&gt;&quot;
			oXmlFile.WriteLine &quot;&lt;Parameters&gt;&quot; &amp; sGuid &amp; &quot; ##Sub:Name## ##Sub:ResourceID## ##SUB:ItemName## ##SUB:NetworkOSPath## ##SUB:value##&lt;/Parameters&gt;&quot;
			oXmlFile.WriteLine &quot;&lt;/Executable&gt;&quot;
			oXmlFile.WriteLine &quot;&lt;/ActionDescription&gt;&quot;
			oXmlFile.Close

			' Copy XML to GUID-directory with name &quot;snowland-GUID.xml&quot; as name
			oFso.CopyFile oShell.ExpandEnvironmentStrings(&quot;%TEMP%\snowland-guid-locator.xml&quot;), sSourcePath &amp; sGuid &amp; &quot;\snowland-&quot; &amp; sGuid &amp; &quot;.xml&quot;
		End if
	End If
Loop
oFile.Close
</pre>
<p>So&#8230; when you restarted the console you will se GUID&#8217;s showing up. To get those GUID&#8217;s to the clipboard use a <strong>testExtension.vbs</strong> like this</p>
<pre class="brush: vb;">
Set oFso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set oShell = CreateObject(&quot;WScript.Shell&quot;)

' Create a temporary file
Set oFile = oFso.CreateTextFile(oShell.ExpandEnvironmentStrings(&quot;%TEMP%\sccmXmlReader.tmp&quot;), True)

' Loop thru arguments
For i = 0 to WScript.Arguments.Count-1
	sOut = sOut &amp; Wscript.Arguments(i) &amp; VbCrLf
	' Write to file
	oFile.WriteLine Wscript.Arguments(i)
Next
' Close the file
oFile.Close

' Type the file to the clipboard
oShell.Run oShell.ExpandEnvironmentStrings(&quot;%SystemRoot%\System32\cmd.exe /c type %TEMP%\sccmXmlReader.tmp | %SystemRoot%\System32\clip.exe&quot;), 1, True

' Delete the file
oFso.DeleteFile oShell.ExpandEnvironmentStrings(&quot;%TEMP%\sccmXmlReader.tmp&quot;), True

' Send a message to the user
MsgBox sOut, vbOKOnly, &quot;Copied to clipboard&quot;
</pre>
<p>Will try to do a post about how to find the SUB&#8217;s&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/05/06/sccm-console-extensions-find-the-guid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outlook inbox cleaner</title>
		<link>http://www.snowland.se/2009/03/23/outlook-inbox-cleaner/</link>
		<comments>http://www.snowland.se/2009/03/23/outlook-inbox-cleaner/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 08:29:29 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[Good-to-have]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Cleaner]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Outlook]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=238</guid>
		<description><![CDATA[I like to keep my inbox clean&#8230; so every now and then I sort out mails to different folders. That is boooring.
So I wrote a little script.  

Sub InboxCleaner()
    Dim oNamespace As Outlook.NameSpace
    Dim oInboxFolder As Outlook.MAPIFolder
    Dim oDestFolder As Outlook.MAPIFolder
    Dim [...]]]></description>
			<content:encoded><![CDATA[<p>I like to keep my inbox clean&#8230; so every now and then I sort out mails to different folders. That is boooring.</p>
<p>So I wrote a little script. <img src='http://www.snowland.se/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<pre class="brush: vb;">
Sub InboxCleaner()
    Dim oNamespace As Outlook.NameSpace
    Dim oInboxFolder As Outlook.MAPIFolder
    Dim oDestFolder As Outlook.MAPIFolder
    Dim oItem As Object
    Dim i, iMove, iNoMove As Integer
    Dim sMsg, sFolder As String
    Dim bDoMove As Boolean

    Set oNamespace = Application.GetNamespace(&quot;MAPI&quot;)
    Set oInboxFolder = oNamespace.GetDefaultFolder(olFolderInbox)

    sMsg = &quot;&quot;
    iNoMove = 0
    iMove = 0

    For i = oInboxFolder.Items.Count To 1 Step -1
        Set oItem = oInboxFolder.Items(i)

        If InStr(oItem.SenderEmailAddress, &quot;@&quot;) &lt;&gt; 0 Then
            sFolder = oItem.SenderEmailAddress ' Get sender address
            sFolder = Right(sFolder, Len(sFolder) - InStrRev(sFolder, &quot;@&quot;)) ' Only domain name
            sFolder = Left(sFolder, InStr(sFolder, &quot;.&quot;) - 1) ' Skip everything after the first dot
            sFolder = UCase(Left(sFolder, 1)) &amp; Right(sFolder, Len(sFolder) - 1) ' Upper case first letter

            On Error Resume Next
            ' This row you might want to customize... I have a folders like  Mailbox\Customers\TheCustomerName
            Set oDestFolder = oInboxFolder.Folders.Parent.Parent.Folders(&quot;Customers&quot;).Folders(sFolder)

            If Err.Number &lt;&gt; 0 Then
                sMsg = sMsg &amp; &quot;Missing folder: &quot; &amp; vbTab &amp; oItem.SenderEmailAddress &amp; &quot;  (&quot; &amp; sFolder &amp; &quot;)&quot; &amp; vbCrLf
                Set oDestFolder = Nothing
                Err.Clear
                bDoMove = False
                iNoMove = iNoMove + 1
            Else
                sMsg = sMsg &amp; &quot;Move:           &quot; &amp; vbTab &amp; oItem.SenderEmailAddress &amp; &quot; -&gt; &quot; &amp; sFolder &amp; vbCrLf
                bDoMove = True
                iMove = iMove + 1
            End If
            On Error GoTo 0

            If bDoMove Then
            	' Comment out this line if you only want to test
                oItem.Move oDestFolder
            End If
        End If
    Next

    sMsg = sMsg &amp; vbCrLf &amp; _
        vbCrLf &amp; _
        &quot;Processed &quot; &amp; oInboxFolder.Items.Count &amp; &quot; items in inbox...&quot; &amp; vbCrLf &amp; _
        &quot;Moved:          &quot; &amp; vbTab &amp; iMove &amp; vbCrLf &amp; _
        &quot;Missing folder: &quot; &amp; vbTab &amp; iNoMove &amp; vbCrLf &amp; _
        &quot;Skipped:        &quot; &amp; vbTab &amp; (oInboxFolder.Items.Count - (iMove + iNoMove))

    MsgBox sMsg, vbOKOnly, &quot;Inbox Cleaner / Rikard Ronnkvist / snowland.se&quot;

End Sub
</pre>
<p>Download: <a href='http://www.snowland.se/wp/wp-content/uploads/inboxcleaner.vbs'>inboxcleaner.vbs</a></p>
<p>Update: Screendump of the result.<br />
<img src="http://www.snowland.se/wp/wp-content/uploads/090323_inboxcleaner.png" alt="090323_inboxcleaner" title="090323_inboxcleaner" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/03/23/outlook-inbox-cleaner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bulk update commandlines in SCCM-programs</title>
		<link>http://www.snowland.se/2009/03/19/bulk-update-commandlines-in-sccm-programs/</link>
		<comments>http://www.snowland.se/2009/03/19/bulk-update-commandlines-in-sccm-programs/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 08:27:29 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[ConfigMgr]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Bulk]]></category>
		<category><![CDATA[Programs]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=235</guid>
		<description><![CDATA[Just a small script to update the commandline of a large number of programs in SCCM.
This script will change from &#8220;/q&#8221; to &#8220;/qb!&#8221;&#8230;

Set oLocator = CreateObject(&#34;WbemScripting.SWbemLocator&#34;)
Set oSccmWmi = oLocator.ConnectServer(&#34;.&#34;, &#34;root\sms\site_C01&#34;, &#34;&#34;, &#34;&#34;)

Set oPrograms = oSccmWmi.ExecQuery(&#34;select * from SMS_Program where CommandLine LIKE '%msiexec%/q %'&#34;)

For Each oProgram In oPrograms
	WScript.Echo &#34;Package: &#34; &#38; oProgram.PackageID &#38; &#34;  (&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Just a small script to update the commandline of a large number of programs in SCCM.</p>
<p>This script will change from &#8220;/q&#8221; to &#8220;/qb!&#8221;&#8230;</p>
<pre class="brush: vb;">
Set oLocator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;)
Set oSccmWmi = oLocator.ConnectServer(&quot;.&quot;, &quot;root\sms\site_C01&quot;, &quot;&quot;, &quot;&quot;)

Set oPrograms = oSccmWmi.ExecQuery(&quot;select * from SMS_Program where CommandLine LIKE '%msiexec%/q %'&quot;)

For Each oProgram In oPrograms
	WScript.Echo &quot;Package: &quot; &amp; oProgram.PackageID &amp; &quot;  (&quot; &amp; oProgram.ProgramName &amp; &quot;)&quot;
	WScript.Echo &quot;Orginal: &quot; &amp; oProgram.CommandLine

	sNewCmd = Replace(oProgram.CommandLine, &quot;/q&quot;, &quot;/qb!&quot;)
	WScript.Echo &quot;    New: &quot; &amp; sNewCmd

	Set oModProgram = oSccmWmi.Get(&quot;SMS_Program.PackageID='&quot; &amp; oProgram.PackageID &amp; &quot;'&quot; &amp; &quot;,ProgramName='&quot; &amp; oProgram.ProgramName &amp; &quot;'&quot;)
	oModProgram.CommandLine = sNewCmd
	oModProgram.Put_ ' Comment out this line if you want to test
	Set oModProgram = Nothing
Next
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/03/19/bulk-update-commandlines-in-sccm-programs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Trigger SCCM-client actions</title>
		<link>http://www.snowland.se/2009/02/19/trigger-sccm-client-actions/</link>
		<comments>http://www.snowland.se/2009/02/19/trigger-sccm-client-actions/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 11:40:02 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[ConfigMgr]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Actions]]></category>
		<category><![CDATA[Client]]></category>
		<category><![CDATA[Trigger]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=227</guid>
		<description><![CDATA[If you need to trigger some SCCM-client actions via a script, this is a easy way to do it.
This script will trigger actions with &#8220;Request &#038; Evaluate&#8221; in the name.

Option Explicit
Dim oCpApplet, oActions, oAction

On Error Resume Next
Set oCpApplet = CreateObject(&#34;CPAPPLET.CPAppletMgr&#34;)
If Err.Number &#60;&#62; 0 Then
    WScript.Echo &#34;Missing SCCM-client&#34;
    Err.Clear
Else
  [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to trigger some SCCM-client actions via a script, this is a easy way to do it.</p>
<p>This script will trigger actions with &#8220;Request &#038; Evaluate&#8221; in the name.</p>
<pre class="brush: vb;">
Option Explicit
Dim oCpApplet, oActions, oAction

On Error Resume Next
Set oCpApplet = CreateObject(&quot;CPAPPLET.CPAppletMgr&quot;)
If Err.Number &lt;&gt; 0 Then
    WScript.Echo &quot;Missing SCCM-client&quot;
    Err.Clear
Else
    WScript.Echo &quot;Found following actions:&quot;
    Set oActions = oCpApplet.GetClientActions
    For Each oAction In oActions
        If Instr(lCase(oAction.Name),&quot;request &amp; evaluate&quot;) Then
            WScript.Echo &quot;  &quot; &amp; oAction.Name &amp; &quot; - Starting&quot;
            oAction.PerformAction
        Else
            WScript.Echo &quot;  &quot; &amp; oAction.Name
        End If
    Next
End If
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/02/19/trigger-sccm-client-actions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Collection Refresh Rate</title>
		<link>http://www.snowland.se/2009/01/23/change-collection-refresh-rate/</link>
		<comments>http://www.snowland.se/2009/01/23/change-collection-refresh-rate/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 11:34:51 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[ConfigMgr]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Collection]]></category>
		<category><![CDATA[Refresh]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=215</guid>
		<description><![CDATA[Had some problems with loads of collection refresh taking all of the CPU on the SCCM-server.
So first, to get the SCCM-server to calm down I wrote a small (and somewhat ugly, since it uses SQL) hack:

UPDATE Collections
Set Flags = 17
Where CollectionName LIKE '%Something In The Collection Name%'
AND Flags=18

This script uncheck the box &#8220;Update his collection [...]]]></description>
			<content:encoded><![CDATA[<p>Had some problems with loads of collection refresh taking all of the CPU on the SCCM-server.</p>
<p>So first, to get the SCCM-server to calm down I wrote a small (and somewhat ugly, since it uses SQL) hack:</p>
<pre class="brush: sql;">
UPDATE Collections
Set Flags = 17
Where CollectionName LIKE '%Something In The Collection Name%'
AND Flags=18
</pre>
<p>This script uncheck the box &#8220;Update his collection on a schedule&#8221; for the collections.</p>
<p>Then, when the SCCM server did go back to a normal CPU-utilization we used this script to set another refresh-rate on the collections.</p>
<pre class="brush: vb;">
Const cSccmProvider = &quot;.&quot;
Const cWmiUsername = &quot;&quot;
Const cWmiPassword = &quot;&quot;

Const cCollectionNamePattern = &quot;%Something In The Collection Name%&quot;
Const cDoUpdate = True		' Set to false to test
Const cRefreshDays = 0		' 0 - 31
Const cRefreshHours = 12	' 0 - 23
Const cRefreshMinutes = 0	' 0-59

Set oLocator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;)

' --- Get SCCM Site Code
WScript.Echo &quot;Connecting to: &quot; &amp; cSccmProvider
Set oSccmWmi = oLocator.ConnectServer(cSccmProvider, &quot;root\sms&quot;, cWmiUsername, cWmiPassword)
Set oWmiQuery = oSccmWmi.ExecQuery(&quot;SELECT SiteCode FROM SMS_ProviderLocation WHERE ProviderForLocalSite=true&quot;)
For each currentSite in oWmiQuery
	sSccmSiteCode = currentSite.SiteCode
	Exit For
Next

' --- Connect to site
WScript.Echo &quot;Connecting to: &quot; &amp; cSccmProvider &amp;  &quot; - root\sms\site_&quot; &amp; sSccmSiteCode
Set oSccmWmi = oLocator.ConnectServer(cSccmProvider, &quot;root\sms\site_&quot; &amp; sSccmSiteCode, cWmiUsername, cWmiPassword)

' --- Create interval
WScript.Echo &quot;Creating Interval: &quot; &amp; cRefreshDays &amp; &quot; days, &quot; &amp; cRefreshHours &amp; &quot; hours, &quot; &amp; cRefreshMinutes &amp; &quot; minutes.&quot;
Set oInterval = oSccmWmi.Get(&quot;SMS_ST_RecurInterval&quot;)
oInterval.DaySpan = cRefreshDays
oInterval.HourSpan = cRefreshHours
oInterval.MinuteSpan = cRefreshMinutes
oInterval.isGmt = False
oInterval.StartTime = &quot;20090101000000.000000+***&quot;

' --- List all collection
set oCollections = oSccmWmi.ExecQuery(&quot;SELECT * FROM SMS_Collection WHERE Name LIKE '&quot; &amp; cCollectionNamePattern &amp; &quot;'&quot;)
For Each oCollection In oCollections
	' --- Update interval on Collection
	If cDoUpdate Then
		WScript.Echo &quot;Updating: &quot; &amp; oCollection.CollectionID &amp; &quot; - &quot; &amp; oCollection.Name
		Set oCollectionToChange = oSccmWmi.Get(&quot;SMS_Collection.CollectionID='&quot;  &amp; oCollection.CollectionID &amp; &quot;'&quot;)
		oCollectionToChange .RefreshSchedule = Array(oInterval)
		oCollectionToChange .RefreshType = 2  '1 = Manual, 2 = Periodic refresh
		oCollectionToChange .Put_
	Else
		WScript.Echo &quot;Testing: &quot; &amp; oCollection.CollectionID &amp; &quot; - &quot; &amp; oCollection.Name
	End if
Next
</pre>
<p>The script is attached here: <a href='http://www.snowland.se/wp/wp-content/uploads/changecollectionrefresh.vbs'>changeCollectionRefresh.vbs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2009/01/23/change-collection-refresh-rate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semiautomatic deletion/creation/whatever</title>
		<link>http://www.snowland.se/2008/12/18/semiautomatic-deletioncreationwhatever/</link>
		<comments>http://www.snowland.se/2008/12/18/semiautomatic-deletioncreationwhatever/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 08:36:52 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[VBScript]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Dangerous]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=206</guid>
		<description><![CDATA[Ok.. you need to automate a klick-klick-klick-procedure&#8230;  SendKeys can do the trick.
A big warning: This might be dangerous, if the script goes berserk&#8230; it might do whatever deletion/creation/manipulation in the wrong area&#8230;

Set oShell = CreateObject(&#34;WScript.Shell&#34;)

oShell.AppActivate &#34;Configuration Manager Console&#34;
WScript.Sleep 500

For i = 1 To 10
	oShell.SendKeys &#34;{DOWN}&#34;
	WScript.Sleep 250
	oShell.SendKeys &#34;{DELETE}&#34;
	WScript.Sleep 250
	oShell.SendKeys &#34;{ENTER}&#34;

	WScript.Sleep 2000
Next
MsgBox &#34;Done!&#34;

]]></description>
			<content:encoded><![CDATA[<p>Ok.. you need to automate a klick-klick-klick-procedure&#8230;  SendKeys can do the trick.</p>
<p>A big warning: This might be dangerous, if the script goes berserk&#8230; it might do whatever deletion/creation/manipulation in the wrong area&#8230;</p>
<pre class="brush: vb;">
Set oShell = CreateObject(&quot;WScript.Shell&quot;)

oShell.AppActivate &quot;Configuration Manager Console&quot;
WScript.Sleep 500

For i = 1 To 10
	oShell.SendKeys &quot;{DOWN}&quot;
	WScript.Sleep 250
	oShell.SendKeys &quot;{DELETE}&quot;
	WScript.Sleep 250
	oShell.SendKeys &quot;{ENTER}&quot;

	WScript.Sleep 2000
Next
MsgBox &quot;Done!&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2008/12/18/semiautomatic-deletioncreationwhatever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check WMI on SCCM-server</title>
		<link>http://www.snowland.se/2008/12/09/check-wmi-on-sccm-server/</link>
		<comments>http://www.snowland.se/2008/12/09/check-wmi-on-sccm-server/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 08:31:38 +0000</pubDate>
		<dc:creator>riro</dc:creator>
				<category><![CDATA[ConfigMgr]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[check]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.snowland.se/?p=184</guid>
		<description><![CDATA[If you have problems with WMI on a SCCM server you have will have loads of strange things happening.
Wrote a small VBScript to check WMI&#8230; here it is:

Set oLocator = CreateObject(&#34;WbemScripting.SWbemLocator&#34;)

' --- Checking local WMI
WScript.Echo &#34; Connect: root\CIMV2&#34;
Set oWMIService = oLocator.ConnectServer(&#34;.&#34;, &#34;root\CIMV2&#34;, &#34;&#34;, &#34;&#34;)

WScript.Echo &#34;   Query: Select UUID from Win32_ComputerSystemProduct&#34;
Set oWmiQuery = oWMIService.ExecQuery(&#34;Select [...]]]></description>
			<content:encoded><![CDATA[<p>If you have problems with WMI on a SCCM server you have will have loads of strange things happening.</p>
<p>Wrote a small VBScript to check WMI&#8230; here it is:</p>
<pre class="brush: vb;">
Set oLocator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;)

' --- Checking local WMI
WScript.Echo &quot; Connect: root\CIMV2&quot;
Set oWMIService = oLocator.ConnectServer(&quot;.&quot;, &quot;root\CIMV2&quot;, &quot;&quot;, &quot;&quot;)

WScript.Echo &quot;   Query: Select UUID from Win32_ComputerSystemProduct&quot;
Set oWmiQuery = oWMIService.ExecQuery(&quot;Select UUID from Win32_ComputerSystemProduct&quot;)
For Each oUuid In oWmiQuery
	sUuid = oUuid.UUID
	WScript.Echo &quot;Response: &quot; &amp; sUuid
	Exit For
Next
WScript.Echo &quot;&quot;

' --- Figure out site code
WScript.Echo &quot; Connect: root\sms&quot;
Set oWMIService = oLocator.ConnectServer(&quot;.&quot;, &quot;root\sms&quot;, &quot;&quot;, &quot;&quot;)

WScript.Echo &quot;   Query: SELECT SiteCode FROM SMS_ProviderLocation WHERE ProviderForLocalSite=true&quot;
Set oWmiQuery = oWMIService.ExecQuery(&quot;SELECT SiteCode FROM SMS_ProviderLocation WHERE ProviderForLocalSite=true&quot;)
For each currentSite in oWmiQuery
	sSccmSiteCode = currentSite.SiteCode
	WScript.Echo &quot;Response: &quot; &amp; sSccmSiteCode
	Exit For
Next
WScript.Echo &quot;&quot;

' --- Connect to site
WScript.Echo &quot; Connect: root\sms\site_&quot; &amp; sSccmSiteCode
Set oWMIService = oLocator.ConnectServer(&quot;.&quot;, &quot;root\sms\site_&quot; &amp; sSccmSiteCode, &quot;&quot;, &quot;&quot;)

WScript.Echo &quot;   Query: Select Name, ResourceID FROM SMS_R_System WHERE SmbiosGuid = '&quot; &amp; sUuid &amp; &quot;'&quot;
Set oWmiQuery = oWMIService.ExecQuery(&quot;Select ResourceID FROM SMS_R_System WHERE SmbiosGuid = '&quot; &amp; sUuid &amp; &quot;'&quot;)
For each myMachine in oWmiQuery
	WScript.Echo &quot;Response: &quot; &amp; myMachine.ResourceID
	Exit For
Next
</pre>
<p>Or download here: <a href='http://www.snowland.se/wp/wp-content/uploads/wmitester.vbs'>wmiTester.vbs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.snowland.se/2008/12/09/check-wmi-on-sccm-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
