' StopService.vbs
' Author Guy Thomas http://computerperformance.co.uk
' Version 2.7 - March 2005
' ----------------------------------------'
'
Option Explicit
Dim objService, objWMI, colListOfServices, intExSrv
Dim strExService1, strExService2, strExService3, strExService4
Dim strComp, strWMIsrv
' Amend strExService if you do not have exchange e.g. Alerter
strExService1 = "MSexchangeIS"
strExService2 = "MSexchangeMTA"
strExService3 = "MSexchangeSA"
strExService4 = "MSexchangeSRS"
intExSrv = 1
' Loops through all the Exchange services
' Uses Select Case rather than If then Elseif, end if.
For intExSrv = 1 To 4
Select Case intExSrv
Case 1 strWMIsrv = strExService1
Case 2 strWMIsrv = strExService2
Case 3 strWMIsrv = strExService3
Case 4 strWMIsrv = strExService4
End Select
WScript.Echo "strWMIsrv = " & strWMIsrv
' Section using WMI to interrogate the services
' Note "." means local computer.
' Note strWMIsrv in Line 37 (ish)
strComp = "."
Set objWMI = GetObject("winmgmts:\\" & strComp & "\root\cimv2")
Set colListOfServices = objWMI.ExecQuery("Select * from " _
& "Win32_Service Where Name ='" & strWMIsrv & "'")
' See how it cycles through colListofServices until it gets a match
' Then stops the objService
For Each objService in colListOfServices
objService.StopService()
Next
Next
WScript.Echo "Now check: Services, MS Exchange xx" & vbCr _
& "This script cuts the time it takes to reboot your Exchange server."
WScript.Quit
' End of Script
-------------------
Thanks,
http://sccm07.blogspot.com/
Tuesday, January 13, 2009
VBSCRIPT To Shutdown Exchange 200x server
Monday, January 12, 2009
SCCM Client Installation Script:-- batch file program
SCCM Client Installation Script:--
here is my SCCM Client Installation batch file script.
================================================================================================================================================================================
ECHO *********** %1 runing X copy kil.exe
xcopy /y kill.exe \\%1\admin$
psexec \\%1 -c kill.exe "kill.exe ccmexec.exe"
ECHO *********** %1 Uninstall SCCM Cleint
psexec \\%1 -c kill.exe "kill.exe ccmsetup.exe"
psexec \\%1 \\%1\ADMIN$\ccmsetup.exe /uninstall
ECHO *********** %1 Install SCCM Client
psexec \\%1 \\%1\ADMIN$\ccmsetup.exe fsp=SCCMSERVER smssitecode=auto
================================================================================================================================================================================
SCCM Client: Patch Managemnt to Force Client Deployement on remote systems
To Force Client Deployment
================================================================================================================================================================
' Set the required variables.
actionNameToRun = "Software Updates Assignments Evaluation Cycle"
actionNameToRun = "Software Updates Assignments Evaluation Cycle"
' Create a CPAppletMgr instance.
Dim oCPAppletMgr
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
Dim oCPAppletMgr
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
' Get the available ClientActions object.
Dim oClientActions
Set oClientActions = oCPAppletMgr.GetClientActions()
Dim oClientActions
Set oClientActions = oCPAppletMgr.GetClientActions()
' Loop through the available client actions. Run the matching client action when it is found.
Dim oClientAction
For Each oClientAction In oClientActions
If oClientAction.Name = actionNameToRun Then
oClientAction.PerformAction
End If
Next
================================================================================================================================================================
Dim oClientAction
For Each oClientAction In oClientActions
If oClientAction.Name = actionNameToRun Then
oClientAction.PerformAction
End If
Next
================================================================================================================================================================
Save the script into Force_Deployment.vbs.vbs
====================================================================================================================
The above script will run on only local system. Ofcourse every one wants to run this in remote systems so i created a batch file to run on targeted list of systems ... Here is the Batch file....
===========================================================================
xcopy /y Force_Deployment.vbs \\%1\admin$\temp\
psexec \\%1 \\%1\admin$\temp\Force_Deployment.vbs
===========================================================================
psexec \\%1 \\%1\admin$\temp\Force_Deployment.vbs
===========================================================================
Save the above Batch File with the Name sup.bat
and the synatx to call the batch file is ""For /F %a in (list.txt) do SUP.bat %a"""" Include systems name in list.txt file
==========================================================================
SCCM Client Discovery Data Cycle intiate on remote systems
To intiate Discovery Data Cycle run this Script:---
==================================================================================================================================================================
On Error Resume Next
Dim oCPAppletMgr
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
Dim oClientActions
Set oClientActions = oCPAppletMgr.GetClientActions()
Dim oClientAction
For Each oClientAction In oClientActions
If oClientAction.Name = "Discovery Data Collection Cycle" Then
oClientAction.PerformAction
End If
If oClientAction.Name = "Request & Evaluate Machine Policy" Then
oClientAction.PerformAction
End If
Next
================================================================================================================================================
Dim oCPAppletMgr
Set oCPAppletMgr = CreateObject("CPApplet.CPAppletMgr")
Dim oClientActions
Set oClientActions = oCPAppletMgr.GetClientActions()
Dim oClientAction
For Each oClientAction In oClientActions
If oClientAction.Name = "Discovery Data Collection Cycle" Then
oClientAction.PerformAction
End If
If oClientAction.Name = "Request & Evaluate Machine Policy" Then
oClientAction.PerformAction
End If
Next
================================================================================================================================================
The above script will run on only local system. Ofcourse every one wants to run this in remote systems so i created a batch file to run on targeted list of systems ... Here is the Batch file....
ECHO *********** %1 copy
xcopy /y DDR.vbs \\%1\admin$\temp
===========================================================================
and the synatx to call the batch file is ""For /F %a in (list.txt) do one.bat %a"""" Include systems name in list.txt file
SCCM Client SUP registry Value Check Script
To find SCCM Client have the SUP server Registry key value status
This script will check Weather the Client system is scanning properly with SUP server or not
============================================================================================================================================================================================================================================================
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_LOCAL_MACHINE = &H80000002
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
strValueName = "WUServer"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
If IsNull(dwValue) Then
Wscript.Echo "The registry key does not exist. (" & dwValue & ") and computer name" & StrComputer
Else
Wscript.Echo "The registry key exists. (" & dwValue & ") and computer name" & StrComputer
End If
Wscript.Echo "The registry key does not exist. (" & dwValue & ") and computer name" & StrComputer
Else
Wscript.Echo "The registry key exists. (" & dwValue & ") and computer name" & StrComputer
End If
Loop
''''HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
''''HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
To enable remotely admin$ / default shares on remote systems
To enable remotely admin$ / default shares on remote systems
This script will be useful to enable remotely admin$ shares
============================================================================================================================================
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "Admin Share Exists"
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery("Select * from Win32_Share Where Name = 'ADMIN$'")
objExcel.Cells(intRow, 1).Value = UCase(strComputer)
If colShares.Count > 0 Then
objExcel.Cells(intRow, 2).Value = "Yes"
Else
objExcel.Cells(intRow, 2).Value = "No"
End If
If Err.Number <> 0 Then
objExcel.Cells(intRow, 2).Value = Err.Description
Err.Clear
End If
intRow = intRow + 1
objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
loop
Wscript.Echo "Done"
========================================================================================================================================================================objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "Admin Share Exists"
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colShares = objWMIService.ExecQuery("Select * from Win32_Share Where Name = 'ADMIN$'")
objExcel.Cells(intRow, 1).Value = UCase(strComputer)
If colShares.Count > 0 Then
objExcel.Cells(intRow, 2).Value = "Yes"
Else
objExcel.Cells(intRow, 2).Value = "No"
End If
If Err.Number <> 0 Then
objExcel.Cells(intRow, 2).Value = Err.Description
Err.Clear
End If
intRow = intRow + 1
objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
loop
Wscript.Echo "Done"
-------------------
Thanks,
http://sccm07.blogspot.com/
Friday, January 9, 2009
you can access yahoo messenger if it is blocked also
Subscribe to:
Posts (Atom)