Friday, December 7, 2007

Basics of Communications

MPLS Concepts

Friday, November 30, 2007

RECYCLING THE APPLICATION POOL

On Error Resume Next
strComputer = InputBox _
("Please enter the name of the Computer where ‘XXXXX’ to be Recycled:", _
"Enter ComputerName Name")

if strComputer = "" Then
Wscript.Quit
End If
strUser = InputBox _
("Please enter the UserName:", "Enter UserName")
strPassword = InputBox _
("Please enter the Password:", "Enter Password")
PoolName = InputBox ("Please Enter the Name of the Application Pool :", "Application Pool Name")
Set LocatorObj = CreateObject("WBemScripting.SWbemLocator")
LocatorObj.Security_.ImpersonationLevel = 3
LocatorObj.Security_.AuthenticationLevel = 6
Set ProviderObj = LocatorObj.ConnectServer(strComputer, "\root\microsoftiisv2", strUser, strPassword)

Set colItems = ProviderObj.ExecQuery _
("Select * From IIsApplicationPool Where Name = " & _
"'W3SVC/AppPools/Enter the Application Pool Name'")
For Each objItem in colItems
objItem.Recycle
On Error Goto 0
WScript.Echo "The Application Pool in " & strComputer & " is Recycled"
Next

GETTING THE SHARE DETAILS OF A COMPUTER

strComputer = InputBox (" Please Enter the Computer Name to Know the Share Details",_
"Enter Computer Name")

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colShare = objWMIService.ExecQuery _
("Select * from Win32_Share")

For Each Share In colShare

WScript.Echo " Share Path : " & Share.path & vbTab & vbTab & vbTab & vbTab &" Share location: " & Balaji.Caption
Next
WScript.Sleep 10000

RESTART A REMOTE COMPUTER

' Restart a Computer

strComputer = InputBox (" Please Enter the Computer Name to restart ",_
"Enter Computer Name")

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

'issue shutdown to OS
' 4 = force logoff
' 5 = force shutdown
' 6 = force rebooot
' 12 = force power off
Number = InputBox(" Enter the Number" & vbCrLf & vbCrLf & "4 = Force logoff" & vbCrLf & "5 = Force shutdown" & vbCrLf & "6 = Force rebooot" & vbCrLf & "12 = Force power off", "What you Want to Do")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32ShutDown(Number)
WScript.Echo "The Requested Operation is Performed in " & strComputer
Next

CHECK FOR A PIRTICULAR SERVICE IS AVAILABLE OR NOT And PIPING OUT THE RESULT IN A EXCEL FILE

On Error Resume Next
Set ObjShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set ObjInputFile = fso.OpenTextFile("c:\Machines.txt", 1, True)
Set ObjOutputFile = fso.OpenTextFile("c:\Result.xls", 2, True)

ObjOutputFile.WriteLine "Server Name " & vbTab & "Is Agent Present"

Do While ObjInputFile.AtEndOfLine <> True
strComputer = ObjInputFile.Readline
WScript.Echo "Working on --> " & strComputer

Set objScriptExec = objShell.Exec("Ping -n 2 -w 1000 " & strComputer )
strPingResults = LCase(ObjScriptExec.StdOut.ReadAll)

If InStr(strPingResults,"reply from") Then

Set ObjWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")

Set ColService = ObjWMIService.ExecQuery("SELECT * FROM Win32_Service WHERE Name =' Alerter'")

If ColService.Count = 0 Then
ObjOutputFile.WriteLine strComputer & vbTab & "NO"
End if

For Each Service In ColService
ObjOutputFile.WriteLine strComputer & vbTab & "Yes"
Next
Else

ObjOutputFile.WriteLine strComputer & vbTab & "Unable to Conenct the Server Or the Server Down"
End if

Loop

WScript.Echo " script Completed"

MAILING FROM VBSCRIPT (Triggering a Mail from VBscript using your Public POP enabled account)

Function SendMail()

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "Admin@someOne.com"
objEmail.To = " Admin@someOne.com "
objEmail.CC = " Admin@someOne.com "
objEmail.Subject = "Sent through VBscript--> ack once received: Thanx"
objEmail.TextBody = " This mail is sent through VBscript invoking the SMTP of Gmail and using the Gmail username and passwords"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "http://127.0.0.1"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Your POP Enabled account"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Your POP Enabled account Password"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendserverport") = 587
objEmail.Configuration.Fields.Update
objEmail.Send

' if objEmail.Send <> True then
'Wscript.Echo "Email sent"
'else
'Wscript.Echo "Email not sent"
'end if

End Function

Tuesday, November 27, 2007

Microsoft Internet Explorer navigation

CTRL+B (Open the Organize Favorites dialog box)

CTRL+E (Open the Search bar)

CTRL+F (Start the Find utility)

CTRL+H (Open the History bar)

CTRL+I (Open the Favorites bar)

CTRL+L (Open the Open dialog box)

CTRL+N (Start another instance of the browser with the same Web address)

CTRL+O (Open the Open dialog box, the same as CTRL+L)

CTRL+P (Open the Print dialog box)

CTRL+R (Update the current Web page)

CTRL+W (Close the current window)

Remote desktop connection navigation

CTRL+ALT+END (Open the Microsoft Windows NT Security dialog box)

ALT+PAGE UP (Switch between programs from left to right)

ALT+PAGE DOWN (Switch between programs from right to left)

ALT+INSERT (Cycle through the programs in most recently used order)

ALT+HOME (Display the Start menu)

CTRL+ALT+BREAK (Switch the client computer between a window and a full screen)

ALT+DELETE (Display the Windows menu)

CTRL+ALT+Minus sign (-) (Place a snapshot of the entire client window area on the Terminal server clipboard and provide the same functionality as pressing ALT+PRINT SCREEN on a local computer.)

CTRL+ALT+Plus sign (+) (Place a snapshot of the active window in the client on the Terminal server clipboard and provide the same functionality as pressing PRINT SCREEN on a local computer.)

MMC console window keyboard shortcuts

CTRL+P (Print the current page or active pane)

ALT+Minus sign (-) (Display the window menu for the active console window)

SHIFT+F10 (Display the Action shortcut menu for the selected item)

F1 key (Open the Help topic, if any, for the selected item)

F5 key (Update the content of all console windows)

CTRL+F10 (Maximize the active console window)

CTRL+F5 (Restore the active console window)

ALT+ENTER (Display the Properties dialog box, if any, for the selected item)

F2 key (Rename the selected item)

CTRL+F4 (Close the active console window. When a console has only one console window, this
shortcut closes the console)

Microsoft Management Console (MMC) main window keyboard shortcuts

CTRL+O (Open a saved console)

CTRL+N (Open a new console)

CTRL+S (Save the open console)

CTRL+M (Add or remove a console item)

CTRL+W (Open a new window)

F5 key (Update the content of all console windows)

ALT+SPACEBAR (Display the MMC window menu)

ALT+F4 (Close the console)

ALT+A (Display the Action menu)

ALT+V (Display the View menu)

ALT+F (Display the File menu)

ALT+O (Display the Favorites menu)