16 June 2010

IMP Downloads from MYITFORUM Central place

 

This is the place you will get all must needed tools and software's and documents that you need at your finger tips.

 

http://myitforum.com/cs2/files/

 

script that has WMI connection error will skip it and move to next

strComputer = "MYcomputername"

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

objExcel.Cells(1, 1).Value = "Logon Name"

objExcel.Cells(1, 2).Value = "Full Name"

objExcel.Cells(1, 3).Value = "Description"

objExcel.Cells(1, 4).Value = "Domain"

objExcel.Cells(1, 5).Value = "Password Changeable"

objExcel.Cells(1, 6).Value = "Password Required"

objExcel.Cells(1, 7).Value = "Password Expires"

objExcel.Cells(1, 8).Value = "Account Disabled"

objExcel.Cells(1, 9).Value = "Account Locked Out"

On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
If err.Number <> 0 then
       Call Wscript.echo("Error has occurred connecting to WMI on workstation: " & strComputer)
End if

Set colItems = objWMIService.ExecQuery("Select * from Win32_UserAccount")

For Each objItem in colItems

objExcel.Cells(intRow, 1).Value = objItem.Name

objExcel.Cells(intRow, 2).Value = objItem.FullName

objExcel.Cells(intRow, 3).Value = objItem.Description

objExcel.Cells(intRow, 4).Value = objItem.Domain

If objItem.PasswordChangeable = True Then

objExcel.Cells(intRow, 5).Value = "Yes"

objExcel.Cells(intRow, 5).Font.ColorIndex = 10

Else   

objExcel.Cells(intRow, 5).Value = "No"

objExcel.Cells(intRow, 5).Font.ColorIndex = 3

End If

If objItem.PasswordRequired = True Then

objExcel.Cells(intRow, 6).Value = "Yes"

objExcel.Cells(intRow, 6).Font.ColorIndex = 10

Else   

objExcel.Cells(intRow, 6).Value = "No"

objExcel.Cells(intRow, 6).Font.ColorIndex = 3

End If

If objItem.PasswordExpires = True Then

objExcel.Cells(intRow, 7).Value = "Yes"

objExcel.Cells(intRow, 7).Font.ColorIndex = 10

Else   

objExcel.Cells(intRow, 7).Value = "No"

objExcel.Cells(intRow, 7).Font.ColorIndex = 3

End If

If objItem.Disabled = True Then

objExcel.Cells(intRow, 8).Value = "Yes"

objExcel.Cells(intRow, 8).Font.ColorIndex = 10

Else   

objExcel.Cells(intRow, 8).Value = "No"

objExcel.Cells(intRow, 8).Font.ColorIndex = 3

End If

If objItem.Lockout = True Then

objExcel.Cells(intRow, 9).Value = "Yes"

objExcel.Cells(intRow, 9).Font.ColorIndex = 10

Else   

objExcel.Cells(intRow, 9).Value = "No"

objExcel.Cells(intRow, 9).Font.ColorIndex = 3

End If

intRow = intRow + 1

Next

objExcel.Range("A1:I1").Select

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

MsgBox "Done"

Excel output Script : for file version check well explained

Correct Script

Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add

intRow = 2
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine

intRow = intRow +1
objExcel.Cells(1, 1).Value = "System Name"
objExcel.Cells(1, 2).Value = "Version"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where Name = 'c:\\windows\\system32\\mshtml.dll'")

For Each objFile in colFiles
objExcel.Cells(intRow, 2).Value = objFile.Version
objExcel.Cells(intRow, 1).Value = strComputer
objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Next
loop
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range("B1")
objRange.Sort objRange,1,,,,,,1
' loop
MsgBox "Done"

 

Wrong Script

 

 

Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "System Name"
objExcel.Cells(1, 2).Value = "Version"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where Name = 'c:\\windows\\system32\\mshtml.dll'")
For Each objFile in colFiles
objExcel.Cells(intRow, 2).Value = objFile.Version
objExcel.Cells(intRow, 1).Value = strComputer

objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Next
loop
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range("B1")
objRange.Sort objRange,1,,,,,,1
' loop
MsgBox "Done"

15 June 2010

Send Activity in Inboxes

 

 

image

ConfigMgr / SCCM Roles

image_thumb[1]

image_thumb[8]

SCCM Roles

image

Collection : For software distribution status if system pending for reboot

For software distribution status if system pending for reboot

 

select 
     SMS_R_SYSTEM.ResourceID,
     SMS_R_SYSTEM.ResourceType,
     SMS_R_SYSTEM.Name,
     SMS_R_SYSTEM.SMSUniqueIdentifier,
     SMS_R_SYSTEM.ResourceDomainORWorkgroup,
     SMS_R_SYSTEM.Client
from
     sms_r_system AS sms_r_system
     join SMS_StatMsg  as st on sms_r_system.Name = st.MachineName
     join SMS_AdvertisementStatusInformation sti on st.MessageID = sti.MessageID
where
        sti.messagestate = 102
 

102 is the reboot pending code
you can get the complete list of codes using the following sql query
 select distinct messagestate,MessageStateName from dbo.v_AdvertisementStatusInformation

Collections based on software updates deployment status in Configuration Manager

ConfigMgr sccm patching status based collections

LastEnforcementMessageID
LastEnforcementMessageName

1        Enforcement started   

3        Waiting for another installation to complete

6    General failure

8    Installing update   

9    Pending system restart   

10  Successfully installed update   

11  Failed to install update   

12  Downloading update   

13  Downloaded update   

So in this example we would like to use the status of reboot pending, the WQL query for the collection should look like this:

select 
SMS_R_SYSTEM.ResourceID,
SMS_R_SYSTEM.ResourceType,
SMS_R_SYSTEM.Name,
SMS_R_SYSTEM.SMSUniqueIdentifier,
SMS_R_SYSTEM.ResourceDomainORWorkgroup,
SMS_R_SYSTEM.Client
from
sms_r_system AS sms_r_system
inner join SMS_UpdateComplianceStatus as c on c.machineid=sms_r_system.resourceid
where
c.LastEnforcementMessageID = 9

SMS 2003 Patching : Pending for reboot collection

A collection listing all servers/clients that were pending reboot (see query statement):

 

 

 

select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,       SMS_R_System.SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client
  from SMS_R_System inner join SMS_G_System_PatchStatus on SMS_G_System_PatchStatus.ResourceID = SMS_R_System.ResourceId where SMS_G_System_PatchStatus.LastStateName = "Reboot Pending"    

One other best site to search for rapid links

One other best site to search for rapid links

 

http://www.frameworkmx.com/

Where MS going?

14 June 2010

TO GET THE USER STATUS : Guest account status

 

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InputFile = fso.OpenTextFile("MachineList.Txt")

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

strUserName = "Guest"

On Error Resume Next
Set objUser = GetObject("WinNT://" & strComputer & "/" & strUserName)

If objUser.AccountDisabled = True Then

Wscript.Echo (strUserName) & " Is Disabled On " & UCase(strComputer)

Else

MsgBox UCase(strUserName) & " Is Enabled On " & UCase(strComputer)

End If

loop