How does variable typing affect simple floating point arithmatic operations in Powershell, i.e. what is 1.1 – 1.04 ?

PowerShell is a great scripting language. You can get complex results by just a one liner, which would have taken a couple of lines in the other scripting languages to generate the same output, but don’t be surprised if you find a simple subtraction 1.1 – 1.04 won’t give you the correct answer of 0.06….


ADAM running on Windows 2003 Gives exception 0x8007200a while updating null attributes

Recently, I was working on a scenario where I was trying to update the attributes of ADAM objects. If I clear an attribute value which is null and then I call CommitChanges on the object, it gives me an exception : 0x8007200a (The specified directory service attribute or value does not exist) Here is the…


How to retrieve currently applied GPOs on your local machine using WMI via Windows Scripting Host ( WSH )

  WMI provides two very useful Resultant Set of Policy (RSOP) classes that can be used together to determine the current set of GPOs that are applied to the local machine.   The RSOP_GPO class provides information about GPOs that could be applied to your machine.    Instances of this class are divided into three categories:…

2

An "Access Denied" exception is generated migrating users from Windows 2000 or 2003 domain to a Windows 2008 domain using DsAddSidHistory API and pass "SrcDomainController" & "SrcDomainCreds" as NULL

An “Access Denied” exception is generated migrating users from Windows 2000 or 2003 domain to a Windows 2008 domain using DsAddSidHistory API (http://msdn.microsoft.com/en-us/library/ms675918(VS.85).aspx) and pass “SrcDomainController” & “SrcDomainCreds” as NULL. In general, you do not want to hard code administrator credentials into code.  Not only is this a security risk, because you can figure out…


Getting an exception “The specified directory service attribute or value does not exist”, when you try to search a user in an AD container using System.DirectoryServices.AccountManagement.UserPrincipal::FindByIdentity

This happens because If there is no container  specified, the principal context class will create a System.DirectoryServices.DirectoryEntry object by binding to builtin CN=Users container to start searching for users. System.DirectoryServices is built on top of ADSI.  ADSI by default does an objectclass=* search as part of its normal bind process unless the fastbind flag is…

1

Restoring object from the Active Directory Recycle Bin using AD Powershell

As anyone who has managed the Active Directory knows, if you delete an Active Directory object, although it marked as tombstoned, all the linked and non-linked attribute values are cleared.   It is therefore difficult to reanimate the object because extra steps are required to recreate linked and non-linked attribute values.   In Windows Server 2008…


Working with Group Policy Objects Programmatically – Locating a GPO using the GPMC ( Group Policy Management Console ) object model in C++

In my previous post we discussed how to modify a registry based GPO programmatically.  In this post we will focus on using the GPMC ( Group Policy Management Console ) object model to find a GPO  that contains a specific string in the display name.  The steps for using the GPMC to locate GPOs from…

3

Working with Group Policy Objects Programmatically – simple C++ example illustrating how to modify a registry based policy

In my last bog post: http://blogs.msdn.com/dsadsi/archive/2009/07/23/working-with-group-policy-objects-programmatically-determining-registry-values-to-enable-disable-set-a-specific-policy.aspx I discussed an empirical method to determine the values one needs to write to the registry to enable/disable/set a registry based group policy.  In this post, I will provide a simple C++ function that illustrates how to write the key information into the GPO. For now, lets concentrate on…

10

Working with Group Policy Objects Programmatically – Determining registry values to Enable/Disable/Set a specific policy

Greetings! Over the past few months our team has seen a number of customer requesting information on how to programmatically/create/edit/read registry based GPO information.  I took some time to combine a couple of samples into one that illustrates a number of these concepts. The first question one must answer when working with a registry based…