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

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

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

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.

Download Prerequisites

Microsft Powershell

Dotnet framework 3.5 SP1

For query purpose its does not require any kind of special permission.
See the below link also.

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.
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.
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.

Known Issues for AD DS Backup and Recovery

Windows 2008 Active Directory Operations Guide

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


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.

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.