December 2007 - Posts
In SMS 2003, It's easy to copy one package to multiple Distribution Point (DP). but it's not an pleasant experience to copy multiple packages to one or more DP. So clone a DP is an challenge. There are some third party utility can help us ease the pain.
In SCCM 2007, there is a built in Copy Package Wizard which can select multiple package and copy them to one or more DP. So it's very easy to clone a DP.
One thing worth mention is, the copy package wizard "pre-filters" the copy sources based on the package type. Let's say if we run the wizard from he Software Distribution node, it will only display software package. It we want to copy other packages types (Software Updates, OSD, etc), We have to run the wizard from the appropriate package-type node.
Here is a little VB Script to query WMI and to check if a particular patch is installed.
'On Error Resume Next
strKB = Inputbox ("Enter the KB Number")
' in KB917537 format
x = 2
'Create an Excel Work Sheet
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "KB"
objExcel.Cells(1, 3).Value = "Installed On"
objExcel.Cells(1, 4).Value = "Report Time Stamp"
objExcel.Range("A1:G1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
'Read machine names from a txt file
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
intRow = x
objExcel.Cells(intRow, 1).Value = strComputer
GetPatchInfo
objExcel.Cells(intRow, 4).Value = Now()
x = x + 1
Loop
Wscript.Echo "Done"
'*********************************************************************************************************
'Get patch Status from WMI
Sub GetPatchInfo
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")
Set colPatches = objWMIService.ExecQuery _
("Select * From Win32_QuickFixEngineering Where HotFixID = ‘”& strKB”’'")
For Each objPatch in ColPatches
objExcel.Cells(intRow, 2).Value = objPatch.Description
objExcel.Cells(intRow, 3).Value = objPatch.InstalledOn
Next
End Sub
You can prevent the Configuration manager 2007 client from installing on specific computers when using the client push or software update poing installation methods by editing the Windows registry.
Here is what you need to do:
Start – Run and type regedt32;
Locate SMS_DISCOVERY_DATA_MANATER sub-key under HKEY_LOCAL_MACHINE/Software/Microsoft/SMS?Components/
Double-click ExcludeServers key to open the Edit Multi-String Window
Specify the name of each computer you want to exclude. Presee the Enter key after typing each computer name to ensure that each computername appears on separate line.
When a computer is added to the ExccludeServers list, it is flagged in the site database with an installed status which prevents the client from reinstalling. So if you later remove the computer from the list, this flag remains. In order to install the clietn software, you have to clean the install Flag.
People who eat a lot of red meat and processed meats have a higher risk of several types of cancer, including lung cancer and colorectal cancer. U.S researchers reported on Monday.
http://health.yahoo.com/news/reuters/cancer_meat_dc.html
Scenario – Some time when you manage multiple servers and you want to verify if a particular entry(SearchString) exists in Hosts File…
'On Error Resume Next
Const ForReading = 1
SearchString = Inputbox ("Enter the Entry Value")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Server Name"
objExcel.Cells(1, 2).Value = "Target Entry"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set InputFile = objFSO.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
objExcel.Cells(intRow, 1).Value = strcomputer
GetHostsEntry
intRow = intRow + 1
Loop
objExcel.Range("A1:E1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Wscript.Echo "Done"
'************************************************************************************************
Sub GetHostsEntry
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("\\" & strComputer & _
"\c$\WINDOWS\system32\drivers\etc\hosts")
If objFSO.FileExists(objFile) Then
Set objHostsFile = objFSO.OpenTextFile(objFile, ForReading)
Do Until objHostsFile.AtEndOfStream
strEntry = objHostsFile.Readline
SearchEntry = InStr(strEntry , SearchString)
If SearchEntry > 0 Then
strCurEntry = strEntry
objExcel.Cells(intRow, 2).Value = strCurEntry
End If
Loop
objHostsFile.Close
Else
objExcel.Cells(intRow, 2).Value = "Hosts File Not Exist"
End If
End Sub
Microsoft Announced today that the first “release candidate” version of its Windows Vista Service Pack1(SP1) will be avaliable to a wide group of testers. Other than about 15000 invitation-only beta testers on Microsoft Connect, it is also avaliable for download to MSDN/Technet subscribers. It is said that MS plan to release the SP1 RC bits to the public on TechNet sometime next week.
Why I am so anxious about this SP1 release. Because I recently got a new Vista computer and I installed PowerShell 2.0 CTP on it. It turns out that in order to make use PowerShell remoting feature on Vista – SP1 is required!
This is a VB Script and it is a “make over” of my previous post http://myitforum.com/cs2/blogs/yli628/archive/2007/11/15/vb-script-to-check-size-and-modified-date-for-a-list-of-files.aspx and it just makes the output looks nice.
What it does is to enumarate through a list of files and for each file it check aginst multiple servers and see if they all have the same modified date and file size. It then writes the results to an excel sheet.
On Error Resume Next
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "File Name"
objExcel.Cells(1, 2).Value = "Server Name"
objExcel.Cells(1, 3).Value = "File Date"
objExcel.Cells(1, 4).Value = "File Size (Byte)"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set InputFileX = oFSO.OpenTextFile("C:\Temp\FileList.Txt")
Do While Not (InputFileX.atEndOfStream)
FileName = InputFileX.ReadLine
objExcel.Cells(intRow, 1).Value = FileName
Set InputFileY = oFSO.OpenTextFile("C:\Temp\MachineList.Txt")
Do While Not (InputFileY.atEndOfStream)
strComputer = InputFileY.ReadLine
objExcel.Cells(intRow, 2).Value = strcomputer
FileName = "\\" + StrComputer + "\" + FileName
Set TargetFile = OFSO.GetFile(Filename)
Modifieddate = TargetFile.DateLastModified
objExcel.Cells(intRow, 3).Value = Modifieddate
FileSize = TargetFile.Size
objExcel.Cells(intRow, 4).Value = FileSize
intRow = intRow + 1
Loop
Loop
objExcel.Range("A1:E1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
Wscript.Echo "Done"
In my previous post, I discussed how to configure Agent Failover Between Multiple Gateway Servers using PowerShell. Today, I am going to show an example as to how to configure Gateway Server failover to Multiple Management Servers.
$PrimaryMS = Get-ManagementServer | Where { Your Filter Here}
$failoverMS = Get-ManagementServer | Where { Your Filter Here}
$gatewayMS = Get-ManagementServer | Where { Your Filter Here}
Set-ManagementServer -GatewayManagementServer: $gatewayMS -ManagementServer: $PrimaryMS -FailoverServer: $failoverMS
You could see that this is very similar to my previous script – there is only one line difference. -GatewayManagementServer: $gatewayMS
If you need to deployed multiple Gateway servers into a domain that does not have a trust relationship established with the domain that the rest of the Management Group is in, You can configure agents to utilize those Gateway servers for failover. But you have to use the SCOM command shell to do this.
Here is an example:
$PrimaryMS = Get-ManagementServer | Where { Your Filter Here}
$FailoverMS = Get-ManagementServer | Where { Your Filter Here}
$Agent = Get-Agent | where {Your Filter Here}
Set-ManagementServer -AgentManagedComputer: $Agent -ManagementServer: $PrimaryMS -FailoverServer: $FailoverMS