Saturday, May 31, 2008

SMS / SCCM helpful forums

Here a few of the places I haunt to give or received information

SCCM Forum

SMS Newgroups

MyITForum

Vbscript behavior


Wscript Method wscript x.vbs



Cscript Method cscript x.vbs


Do you have right click tools that run in a command (DOS) box. And you have an "Enter" key function so it will stay open so you can see the data.

There are 2 things you can do.
1. Run with a wscript xxx.vbs
This will force it to use the wscript method and data will be placed in a nice popup box
2. Set the default method for vbscript to wscript
wscript /H:WScript
A popup will tell you that the default is now wscript do the same with a cscript to change it back


This will make some of the right click tools that display information alot easier to read and gives it a more professional look.

Friday, May 30, 2008

SMS OU to Collection Tool

Edit: 12/2008 I have the tool on myITforum under the beta section SCCM OU Collection Creator - Matthew Hudson

Well I have a new tool that I might give to the community to test. I have finished but it is very rough. The basic idea came several years ago when I was creating our SMS collections. We have a collection called Departments. In it I have the different OU represent so I can do limits or deployments. The problem is that we have many departments so I only make a collection as needed. The new tool will query your AD via LDAP. It will look to your SCCM control file for the correct ldap path. It will then give you the structure for you to click on for import. Once you have all your OUS you click import and about 4 to 6 seconds later you have your entire AD struction in SCCM with the queries written for it as well. I have a few bugs to work out but I hope to give it to some people for testing. I think it would be a good tool. Granted most people might only use it 1 or 2 times.

When it gets posted it will most likely be via MyITforum.

SMS Exam

Well after dragging my feet I finally took the SMS Exam 70-089. I passed with a 936. Now on to 70-401, SCCM exam.

Tuesday, May 20, 2008

Internet Based Client setup

Did you already deploy the client to your machines? Did you want to setup some laptops or computers with Internet Based management. Use this vbscript to push the change to the necessary computers:

-------Internetclient.vbs----------------
On Error Resume Next

Dim newInternetBasedManagementPointFQDN
Dim client

newInternetBasedManagementPointFQDN = "foo.com"

set client = CreateObject ("Microsoft.SMS.Client")
client.SetInternetManagementPointFQDN newInternetBasedManagementPointFQDN

' Clear variables.
Set client = Nothing
Set internetBasedManagementPointFQDN = Nothing
--------------------------------------------------------

Tuesday, May 13, 2008

Collections with Maintenance Windows

Here is an update to my previous vbscript file that had collection listings.
This vbscript can be run from the console of SCCM. It will tell you what user a collection is in, what collection a computer is in. You also have the option of seeing if a maintenance window is set to the collection. This is my first version of this. Please let me know any changes

------------------compmain.vbs----------------------
'Matthew Hudson
'There is no warranty, run code at your own risk

''' sytanx: Application ResourceID Option
' option= blank No tag
' option=1 Collections with Maintenance windows will have a *
' option=2 Collections with Maintenance windows will have a description next to them


on error resume next
Dim CollectionArray(100)
Dim MainWindowArray(100)
count=0

Set objArgs = WScript.Arguments
if (objArgs.count > 1) then
Mainoption = wscript.arguments.item(1)
end if
ResourceID = wscript.arguments.item(0)


Set Shell = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set SWbemLocator=CreateObject("WbemScripting.SWbemLocator")
set SWbemServices = SWbemLocator.ConnectServer("SERVER","root\SMS\site_XXXX")
Set connection= swbemServices
strQuery = "select * from SMS_CollectionMember_a where ResourceID='"+ ResourceID +"'"
Set Collections = SWbemServices.ExecQuery(strQuery)

'''''''''''''''''' move through the collections
for each Collection in Collections
set Collectionfound=SWbemServices.Get("SMS_Collection='" & Collection.CollectionID & "'" )
CollectionArray(count)=Collectionfound.Name
'''''' see if there is a maintenance window
Set collectionSettingsInstance = SWbemServices.Get("SMS_CollectionSettings.CollectionID='" & Collection.CollectionID &"'" )
Set allCollectionSettings = connection.ExecQuery("Select * From SMS_CollectionSettings Where CollectionID = '" & Collection.CollectionID & "'")
If allCollectionSettings.Count > 0 then
MaintenanceWindowArray = collectionSettingsInstance.ServiceWindows
'wscript.echo Collectionfound.Name & len(MaintenanceWindowArray(0).Name)
if Mainoption="2" then
MainWindowArray(count)=MaintenanceWindowArray(0).Description
end if
if Mainoption="1" then
MainWindowArray(count)="*"
end if
end if

count=count+1
Next
'''''''''''''''
'Sort Collection list
for i = count - 2 To 0 Step -1
for j= 0 to i
if CollectionArray(j)>CollectionArray(j+1) then
temp=CollectionArray(j+1)
temp2=MainWindowArray(j+1)
CollectionArray(j+1)=CollectionArray(j)
MainWindowArray(j+1)=MainWindowArray(j)
CollectionArray(j)=temp
MainWindowArray(j)=temp2
end if
next
next
''' print out the collection listing
For NC = 0 to count-1
WhatCollections= WhatCollections & CollectionArray(NC) & " " & MainWindowArray(NC) & VbCrLf

Next
Wscript.echo WhatCollections

'''''''''''''''


'
-------------------------------------
<ActionDescription Class="Group" DisplayName="MCNS" MnemonicDisplayName="MCNS" Description="MCNS Tools" SqmDataPoint="100">

<ActionGroups>
<ActionDescription Class="Executable" DisplayName="Collection Listing" MnemonicDisplayName="Collection Listing" Description="Display machine Collection membership">
<Executable>
<FilePath>C:\Program Files\MCNS\collections\compmain.vbs</FilePath>
<Parameters>##SUB:ResourceID## 1</Parameters>
</Executable>
</ActionDescription>
</ActionGroups>
</ActionDescription>


If the tool vbscript just runs a black box and disappears then check out this link

http://sms-hints-tricks.blogspot.com/2008/05/vbscript-behavior.html