Saturday 26 March 2011

Query a reg key for bulk computer

On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
Set oFso = CreateObject("Scripting.FileSystemObject")
sDesktop = objShell.SpecialFolders("Desktop")
spath = sDesktop & "\Dclist.txt"
Set oT = oFso.OpenTextFile(spath,1)
Do Until oT.AtEndofStream
temp= oT.ReadLine()
strComputer = Trim(temp)

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002


Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "Hardware\DESCRIPTION\SYSTEM\BIOS\"
strValueName = "SystemManufacturer"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "OS Architecture for" & " " & strComputer & " " & "is: " & strValue
Loop

Monday 21 February 2011

Quest Powershell Script For Active Directory

How to find group members for n number of groups
$groups=get-content groups.txtForeach($group in $groups){Get-QADGroupMember $groupGet-qadgroup $group}

Find memberof for n number of users with powershell

$users=get-content users.txtForeach($user in $users){get-Qadmemberof $userGet-qaduser $user}
Extract the known attr for "n" number of users
$users= get-content users.txtforeach ($user in $users) {Get-QADuser $user -SerializeValues}

Find the Canonical Name for n number of users

$users= get-content users.txt
foreach ($user in $users) {Get-QADuser $user -sizelimit 0 Format-table canonicalName}

Find the Dispaly Name for n number of users

$users= get-content users.txt
foreach ($user in $users) {Get-QADuser $user -sizelimit 0 Format-table displayname}

Find the Dispaly Name,Caninicalname and Samaccountname for n number of users

$users= get-content users.txt
foreach ($user in $users) {Get-QADuser $user -sizelimit 0 Format-table displayname,canonicalname,samaccountname}

Extract the known attr for "n" number of users

$users= get-content users.txt
foreach ($user in $users) {Get-QADuser $user -SerializeValues}

Sunday 20 February 2011

Quest Powersheel

Guys,
Believe me or not? If yes and you are a MS-Directory Professional try it.
Benefits:

1. Where WAN connectivity is very slow you can work through command line.
2. Prevent accident deletion until you put exact deletion command.
3. You can automate you’re your AD environment.
4. Commands are easy to remember.
5. You can extract reports at a glance for million users with various parameters.

For more information see the below links and find the admin guide.

Download Quest Powersheel with admin guide.

http://www.quest.com/powershell/activeroles-server.aspx

Download Prerequisites

Microsft Powershell

http://support.microsoft.com/kb/968930

Dotnet framework 3.5 SP1
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d0e5dea7-ac26-4ad7-b68c-fe5076bba986&displaylang=en

For query purpose its does not require any kind of special permission.
See the below link also.
http://blogs.technet.com/b/manojnair/archive/2010/12/27/adding-users-to-ad-group-using-quest-powershell-command-lets.aspx


Before running any ps script put the below command.

Set-ExecutionPolicy Unrestricted

Wednesday 16 February 2011

How to create schedule task with system account

schtasks /create /tn "seclog-Backup" /tr c:\file_copy1.vbs /sc monthly /d 1 /ru "System"
schtasks /create /tn "sec-log-Backup" /tr C:\Script\Sec_Log_Copy.vbs /sc HOURLY /ru "System"

Friday 11 February 2011

DFS Refresh issue in Windows XP SP3

Here I am not going to explain what is DFS, yesterday I have fixed one major issue on DFS. The problem was, File list in the Windows Explorer folder is not refreshed after you create, move, or delete files. AS per Microsoft that issue has been fixed with XP SP2 but I have faced the issue in xp SP3.

Resolution Steps:
Install a Hotfix, I have given the Microsoft Link for that and create the below mentioned registry key.
Reboot the PC once.
http://support.microsoft.com/kb/953323
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
On the Edit menu, point to New, and then click DWORD Value. Type NoSimpleNetIDList, and then press ENTER. On the Edit menu, click Modify. Type 1, and then click OK.

Thursday 3 February 2011

Few steps for migrating 2003 to 2008

After completing the forestprep check the schema version and wait for the completeing the replication and then run the domainprep.

How to check the schema version.
http://support.microsoft.com/kb/556086
Schema version for new operation system
Find the Schema version for the operating systems
13 - Windows 2000 Server30 - Windows Server 2003 RTM, Windows 2003 With Service Pack 1, Windows 2003 With Service Pack 231 -Windows Server 2003 R244 - Windows Server 2008 RTM47 - Windows Server 2008 R2
________________________________
Take the system state backup of your schema master then disable the outbound replication and run the forestprep.
Repadmin /options +DISABLE_OUTBOUND_REPL
After getting the success log enable the out bound replication via repadmin.
Repadmin /options -DISABLE_OUTBOUND_REPL
Wait for competing the replication.
Pls see the link also.
http://social.technet.microsoft.com/wiki/contents/articles/migrating-active-directory-domain-controller-from-windows-server-2003-to-windows-server-2008.aspx

Known Issues for AD DS Backup and Recovery

http://technet.microsoft.com/en-us/library/cc771139(WS.10).aspx

Windows 2008 Active Directory Operations Guide

http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=291BDDB7-EDC6-4E6D-9852-A9A14991D67C

You no need to press F8 for logging into DSRM mode for 2008

Enable DSRM Login
bcdedit /set safeboot dsrepair
shutdown -t 0 -r

Disable DSRM login
bcdedit /deletevalue safeboot
shutdown -t 0 –r

First_dc_in_domain_problem

I have found one problem in 2008 (not sure about R2).
below link is for 2003 but I have resolved the same issue on 2008 with the help of below link.

http://www.petri.co.il/first_dc_in_domain_problem.htm

Thursday 6 January 2011

Difference between forwarder and Stub zone

Both the zones are used for name resolution but when we are used stub and when we are used forwarder. I am trying to say as small as possible.
Ex: We need a trust between domain A and domain B and am a system admin of domain A and in future any changes happen in domain B, we may not get those update , here best is stub, why? Because stub is automated process and the changes will update automatically.
Forwarder is a manual process. Assume admin of domain B has changed the DNS server but I don’t have the update, here problem comes-up.

If you are aware of the activity of domain B then you can use the forwarder.

N.B: You can not create stub zone and forwarder together with the same zone name.