PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms..win.server.scripting > Re: generic Domain(AD) connection
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: generic Domain(AD) connection

Réponse
 
LinkBack Outils de la discussion
Vieux 11/10/2007, 18h21   #1
Richard Mueller [MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: generic Domain(AD) connection

mayoza wrote;

> The following script returns the policy in the AD. Can you me with
> one
> thing, I dont want to supply the parameters like dc="?", I want the script
> to
> run under the AD that the user is currently logon to.
>
> ---------------------
> Const MIN_IN_DAY = 1440
> Const SEC_IN_MIN = 60
>
> Set objDomain = GetObject("WinNT://fabrikam")
> Set objAdS = GetObject("LDAP://dc=fabrikam,dc=com")
>
> intMaxPwdAgeSeconds = objDomain.Get("MaxPasswordAge")
> intMinPwdAgeSeconds = objDomain.Get("MinPasswordAge")
> intLockOutObservationWindowSeconds =
> objDomain.Get("LockoutObservationInterval")
> intLockoutDurationSeconds = objDomain.Get("AutoUnlockInterval")
> intMinPwdLength = objAds.Get("minPwdLength")
>
> intPwdHistoryLength = objAds.Get("pwdHistoryLength")
> intPwdProperties = objAds.Get("pwdProperties")
> intLockoutThreshold = objAds.Get("lockoutThreshold")
> intMaxPwdAgeDays = _
> ((intMaxPwdAgeSeconds/SEC_IN_MIN)/MIN_IN_DAY) & " days"
> intMinPwdAgeDays = _
> ((intMinPwdAgeSeconds/SEC_IN_MIN)/MIN_IN_DAY) & " days"
> intLockOutObservationWindowMinutes = _
> (intLockOutObservationWindowSeconds/SEC_IN_MIN) & " minutes"
>
> If intLockoutDurationSeconds <> -1 Then
> intLockoutDurationMinutes = _
> (intLockOutDurationSeconds/SEC_IN_MIN) & " minutes"
> Else
> intLockoutDurationMinutes = _
> "Administrator must manually unlock locked accounts"
> End If
>
> WScript.Echo "maxPwdAge = " & intMaxPwdAgeDays
> WScript.Echo "minPwdAge = " & intMinPwdAgeDays
> WScript.Echo "minPwdLength = " & intMinPwdLength
> WScript.Echo "pwdHistoryLength = " & intPwdHistoryLength
> WScript.Echo "pwdProperties = " & intPwdProperties
> WScript.Echo "lockOutThreshold = " & intLockoutThreshold
> WScript.Echo "lockOutObservationWindow = " &
> intLockOutObservationWindowMinutes
> WScript.Echo "lockOutDuration = " & intLockoutDurationMinutes
> ---------


You can use the RootDSE object to retrieve the Distinguished Name of the
domain the current user authenticated to. If you need the NetBIOS domain
name for the WinNT provider as well, you can use the DomainShortName
property of the ADSystemInfo object. For example:
=========
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")

Set objSysInfo = CreateObject("ADSystemInfo")
strNTDomain = objSysInfo.domainShortName

Set objAds = GetObject("LDAP://" & strDNSDomain)
Set objDomain = GetObject("WinNT://" & strNTDomain)

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


  Réponse avec citation
Vieux 12/10/2007, 08h34   #2
mayoza
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: generic Domain(AD) connection

Thanks a lot.

"Richard Mueller [MVP]" wrote:

> mayoza wrote;
>
> > The following script returns the policy in the AD. Can you me with
> > one
> > thing, I dont want to supply the parameters like dc="?", I want the script
> > to
> > run under the AD that the user is currently logon to.
> >
> > ---------------------
> > Const MIN_IN_DAY = 1440
> > Const SEC_IN_MIN = 60
> >
> > Set objDomain = GetObject("WinNT://fabrikam")
> > Set objAdS = GetObject("LDAP://dc=fabrikam,dc=com")
> >
> > intMaxPwdAgeSeconds = objDomain.Get("MaxPasswordAge")
> > intMinPwdAgeSeconds = objDomain.Get("MinPasswordAge")
> > intLockOutObservationWindowSeconds =
> > objDomain.Get("LockoutObservationInterval")
> > intLockoutDurationSeconds = objDomain.Get("AutoUnlockInterval")
> > intMinPwdLength = objAds.Get("minPwdLength")
> >
> > intPwdHistoryLength = objAds.Get("pwdHistoryLength")
> > intPwdProperties = objAds.Get("pwdProperties")
> > intLockoutThreshold = objAds.Get("lockoutThreshold")
> > intMaxPwdAgeDays = _
> > ((intMaxPwdAgeSeconds/SEC_IN_MIN)/MIN_IN_DAY) & " days"
> > intMinPwdAgeDays = _
> > ((intMinPwdAgeSeconds/SEC_IN_MIN)/MIN_IN_DAY) & " days"
> > intLockOutObservationWindowMinutes = _
> > (intLockOutObservationWindowSeconds/SEC_IN_MIN) & " minutes"
> >
> > If intLockoutDurationSeconds <> -1 Then
> > intLockoutDurationMinutes = _
> > (intLockOutDurationSeconds/SEC_IN_MIN) & " minutes"
> > Else
> > intLockoutDurationMinutes = _
> > "Administrator must manually unlock locked accounts"
> > End If
> >
> > WScript.Echo "maxPwdAge = " & intMaxPwdAgeDays
> > WScript.Echo "minPwdAge = " & intMinPwdAgeDays
> > WScript.Echo "minPwdLength = " & intMinPwdLength
> > WScript.Echo "pwdHistoryLength = " & intPwdHistoryLength
> > WScript.Echo "pwdProperties = " & intPwdProperties
> > WScript.Echo "lockOutThreshold = " & intLockoutThreshold
> > WScript.Echo "lockOutObservationWindow = " &
> > intLockOutObservationWindowMinutes
> > WScript.Echo "lockOutDuration = " & intLockoutDurationMinutes
> > ---------

>
> You can use the RootDSE object to retrieve the Distinguished Name of the
> domain the current user authenticated to. If you need the NetBIOS domain
> name for the WinNT provider as well, you can use the DomainShortName
> property of the ADSystemInfo object. For example:
> =========
> Set objRootDSE = GetObject("LDAP://RootDSE")
> strDNSDomain = objRootDSE.Get("defaultNamingContext")
>
> Set objSysInfo = CreateObject("ADSystemInfo")
> strNTDomain = objSysInfo.domainShortName
>
> Set objAds = GetObject("LDAP://" & strDNSDomain)
> Set objDomain = GetObject("WinNT://" & strNTDomain)
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h48.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12532 seconds with 10 queries