Setting Password policy Programmatically - IADsDomain

Hi,

I have no idea of where to post this issue. If it is not correct place also please try to help me.

I am trying to Get / set Local Security policy-> Account Policy->Password Policy programmatically using VB script.

I am using the following code:

Dim adsNS As IADsContainer
Dim adsDomain As IADsDomain

Set adsNS = GetObject("WinNT:")
adsNS.Filter = Array("domain")

For Each adsDomain In adsNS

MaximumPwdAge = adsDomain.MaxPasswordAge

Here in adsDomain

I am trying to do this for my local computer which is not included in any domain.

I am getting the domain as the system name itself but when trying to retrieve these parameters it is saying following error:

"Application defined or Object defined error".

All password policy attributes are giving the above error.

This is very urgent requirement for me. If any body has any information please help me.

Thanks and Rgds,

Padmaja.

[1040 byte] By [BodanapuPadmaja] at [2008-1-10]