Saturday, October 3, 2009

Change Local Administrator Password In a Domain Envirement.

In resent i had a problem that changing the Local Administrator Password in all the PC that are connected to the domain.and i never liked that go to every PC and change the password.I found a VB script to do that with out any problems. and it works on windows 2008 DC.

01. Open the Notepad and copy and paste the following Script

' Change Local Administrator Password
' 23/09/2009
'...............................................................


On Error Resume Next

Dim fso, CLAPP
Set fso = CreateObject("Scripting.FileSystemObject")

'--------------------------------------------------------------------
' Change the location as You wish
' This will list of computers that has change the Local Admin Password.
'--------------------------------------------------------------------

Set CLAPP = fso.CreateTextFile("c:\Logs\Local administrator Paawords.txt", True)

Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

' -------------------------------------------------
' Change the Domain Name To your domain name.
' DC=Domain name , DC=suffix (COM)
' -------------------------------------------------
objCommand.CommandText = _
"SELECT Name FROM 'LDAP://dc=Knights,dc=local' WHERE objectCategory='computer'"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

Do Until objRecordSet.EOF
strComputer = objRecordSet.Fields("Name").Value

'------------------------------------------------------------------------------------
'Change the names of the Machines that not need to Change the Administrator passwords
'------------------------------------------------------------------------------------
if Instr(1,strComputer, "srv01") Then objRecordSet.MoveNext
if Instr(1,strComputer, "srv02") Then objRecordSet.MoveNext
if Instr(1,strComputer, "DOMAINCONTROLLER3") Then objRecordSet.MoveNext
'-----------------------------------------------------------
' change the Password as you like
'-----------------------------------------------------------
strPassword = "P@ssword"


CLAPP.WriteLine(strComputer & " " & strPassword)
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator")
objUser.SetPassword strPassword

objRecordSet.MoveNext
Loop

CLAPP.Close

02.save this as CLAP.vbs
03.Run it as logon script Using GPO .If you don't know how to do that see the following article.
(http://www.petri.co.il/setting-up-logon-script-through-gpo-windows-server-2008.htm)
04.if you want know more about VB scripting go to http://computerperformance.co.uk/vbscript.

Sunday, September 20, 2009

Port Security In HP Procurve 2610 Switch

01. First You have to log on to the Hp pro-curve Switch using Putty Or Putty connection Manager.

With The IP Address and giving the Usernames and Password

02. After log in to the switch to configure the port security go to config by typing config in the command line inter face.

03.Following will display the all the switch ports by list. If you wand know the port security in a specific port you can add the port no or range at the end of the command

Command: (config)# show port

Eg:(config)# show port-security 1-3, 45, 8

04. Configuring Port-security

Note : Maximum 8 mac address can be attached to one port.

Command:
(config)# port-security (Port-List) learn-mode configured address-limit (No of Address bind to the port-list) Mac-address(MAC Address) Action send-disable.


Eg: (config)# port-security 28 learn-mode configured address-limit 3 mac-address 0016ea-834254 0017ea-834254 action send-disable

05. Removing MAC Address from the list

Command:
(config)# port-security (port-list) address-limit (Mac Address Limit After deleting the intended Mac’s)
(config)# no port-security (port-list) mac-address (MAC Address)

Eg: (config)# port-security 20 address-limit 2
(config)# no port-security 20 mac-address 001f3c-1d7adb

06. After assigning Port security if you plug any PC that the MAC address is not in the
Port list the network port will be locked and cannot access it until enabling that port

07.How to unlock the port

Command:
(config)# interface ethernet (Port-List)
(eth-Port no)# disable
(eth-Port no)# enable

Eg: (config)# interface ethernet 20
(eth-20)# disable
ES-HPSW48-01(eth-20)# enable