1LooksAlive is a cursory status check that runs every 5 seconds (default). This routine simply checks that the disk status is not marked failed. LooksAlive is a cursory status check that runs every 5 seconds (default). This routine simply checks that the disk status is not marked failed. IsAlive is a more thorough check and occurs every 60 seconds (default). This routine checks that the disk status is not marked failed. If status is not failed, then FindFirstFile runs on the root of the disk to make sure the file system is still mounted and the disk is accessible

Sunday, February 18, 2007

There are people who knows why it happens, there are people who explain how to make it happen and there are people who use the above two concept for their own customization.

Suppose one day your manager asks to get over to the role of Active directory team lead. First question that comes to mind, is there any AD Infra documentation about it, In most case it is not. But with powershell by your side, it is simple to get these details. Lets start with Forest

That's all for this post. It is simple idea what you can idea from CMDlets without even going through all places collecting and documenting this information. SInce my test machine doesn't include multiple domains, I can really get hold of better formatting.

Sunday, February 11, 2007

I truly believe in learning new things and try out new things. Even there could be more than one way of doing it, it makes me crazy to put old things in new way, because you never new that it could be done in this way.

Thursday, February 08, 2007

Managing groups in Active Directory with Powershell

Let's do something with groups in Active directory, I have couple of users and one group under OU named Singapore. My intention here is to modify only user accounts and not group so I have condition them with SamAccountType.

$SNGOU=new-object directoryservices.directoryentry("LDAP://ou=singapore,DC=zarays,dc=com") # Let's connect to OU name Singapore$UserObject=$sngou.psbase.Children # Lets get the object under OU

foreach($user in $userobject) { if ($user.sAMAccountType -eq 805306368) { # we want to just update user object and not group object $user.put("Description","Storage Admins") # We change the description to Storage Admins $user.setinfo() # Commit changes }}

Group is created. Now lets add member to this group. Assuming there are several users in OU, we will only add user whose department is Provisioning. But before I go to the code, I would like to share something with you. You won't see member property if you do

$Grp | gm

or $grp.member

cause there is nothing to display but moment you add user, the next moment you do

$grp | gm

you will see member property.

If you are as beginner like me & would like to know the property, simplest way is to use google. After searching 4 hours I got to know Oh what is happening. And similiarly there is attribute called managedby, it is also having same story. There might be many.

$grp.managedBy.Value

$grp.managedBy.Add("CN=Preetam,OU=Singapore,DC=Zarays,DC=com")

$grp.psbase.CommitChanges()

Let's get to adding members to the group. Remember one thing if your CN name has space you will have to use quotes [$grp.member.add("$DN")].

Also you need a distinguished name in order to add it to any particular group, which is quite logical cause it confirms user object is present and where is it.

Tuesday, February 06, 2007

Yesterday there was question in KBC , English version[Original] Who wants to be Millionaire, how many 9's are there from 1 to 100. Before they could answer I answered it quickly with Powershell. This is how

Monday, February 05, 2007

When we think of making any changes in AD, we must start at creating objects. And as always first thing that comes to Mind is to create multiple users. And again here reference are same as previous one's MOW and Arulk. MOW's concept is used but methods I have to use from Arulk, cause things work.

Usually you get a excel sheet from the HR etc dept, I would always convert it into CSV since PowerShell will do the magic for me.

# Passing all data into variables$CN=$UD.CN$SN=$UD.SN$title=$UD.title$description=$UD.description$department=$UD.department$streetAddress=$UD.streetAddress$postalcode=$UD.postalcode$telephoneNumber=$UD.telephoneNumber$givenName=$UD.givenName$company=$UD.company$mail=$UD.mail$homePhone=$UD.homePhone$mobile=$UD.mobile$userPrincipalName=$UD.userPrincipalName$Samaccountname=$UD.Samaccountname

$Indiauser=$IndiaOU.create("user","cn=$cn") #I created actual user here and later I'm

#filling all properties for user$Indiauser.Put("sAMAccountName",$Samaccountname)$Indiauser.put("SN",$SN)$Indiauser.put("Title",$Title)$Indiauser.put("Description",$description)$Indiauser.put("department",$department)$Indiauser.put("streetAddress",$streetAddress)$Indiauser.put('Postalcode',$postalcode)$Indiauser.put('telephoneNumber',$telephoneNumber)$Indiauser.put('givenName',$givenName)$Indiauser.put('company',$company)$Indiauser.put('mail',$mail)$Indiauser.put('homePhone',$homePhone)$Indiauser.put('mobile',$mobile)$Indiauser.put('userPrincipalName',$userPrincipalName)

$Indiauser.setinfo() #All data committed. There are lots of other properties you can

#add}

Below here I'm doing two things, First is enable the user and second set password. Because for some reason I'm not able to get these two things done in above loop. It throws exception. But I'm sure it can be included.

Last and least, I'm sure there much better CMDlets to do this job, but what makes me proud it that I've created this script and I understand it very well. As compare to those VBScript scripts available on the net, I can use it but can't customize it. Thanks GOD there is PowerShell Team of Blogs.