(une fois décompressé, c'est un fichier .chm bourré d'exemples de scripts d'administration)
Disables a user account. -----------------------
Const ADS_UF_ACCOUNTDISABLE = 2 Set objUser = GetObject _ ("LDAP://cn=myerken,ou=management,dcúbrikam,dc=com") intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Si on veut passer l'identifiant du compte en paramètre (de la forme cn=xx,ou=xxx,..), on peut modifier le script ainsi :
Const ADS_UF_ACCOUNTDISABLE = 2 Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Et pour l'activer : -----------------
Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) objUser.AccountDisabled = FALSE objUser.SetInfo
-- May the Force be with You! La Connaissance s'accroît quand on la partage ---------------------------------------------------------- Jean-Claude BELLAMY [MVP] - http://www.bellamyjc.org http://www.bellamyjc.org *
Dans le message news:%23PDK$RHVEHA.644@tk2msftngp13.phx.gbl ,
Erick <nospam@nospam> s'est ainsi exprimé:
(une fois décompressé, c'est un fichier .chm bourré d'exemples de scripts
d'administration)
Disables a user account.
-----------------------
Const ADS_UF_ACCOUNTDISABLE = 2
Set objUser = GetObject _
("LDAP://cn=myerken,ou=management,dcúbrikam,dc=com")
intUAC = objUser.Get("userAccountControl")
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
Si on veut passer l'identifiant du compte en paramètre (de la forme
cn=xx,ou=xxx,..), on peut modifier le script ainsi :
Const ADS_UF_ACCOUNTDISABLE = 2
Set Args=wscript.arguments
if args.count=0 then wscript.quit
Set objUser = GetObject("LDAP://" & args(0))
intUAC = objUser.Get("userAccountControl")
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
Et pour l'activer :
-----------------
Set Args=wscript.arguments
if args.count=0 then wscript.quit
Set objUser = GetObject("LDAP://" & args(0))
objUser.AccountDisabled = FALSE
objUser.SetInfo
--
May the Force be with You!
La Connaissance s'accroît quand on la partage
----------------------------------------------------------
Jean-Claude BELLAMY [MVP] - http://www.bellamyjc.org
http://www.bellamyjc.org Jean-Claude.Bellamy@wanadoo.fr *
JC.Bellamy@free.fr
(une fois décompressé, c'est un fichier .chm bourré d'exemples de scripts d'administration)
Disables a user account. -----------------------
Const ADS_UF_ACCOUNTDISABLE = 2 Set objUser = GetObject _ ("LDAP://cn=myerken,ou=management,dcúbrikam,dc=com") intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Si on veut passer l'identifiant du compte en paramètre (de la forme cn=xx,ou=xxx,..), on peut modifier le script ainsi :
Const ADS_UF_ACCOUNTDISABLE = 2 Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Et pour l'activer : -----------------
Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) objUser.AccountDisabled = FALSE objUser.SetInfo
-- May the Force be with You! La Connaissance s'accroît quand on la partage ---------------------------------------------------------- Jean-Claude BELLAMY [MVP] - http://www.bellamyjc.org http://www.bellamyjc.org *
(une fois décompressé, c'est un fichier .chm bourré d'exemples de scripts d'administration)
Disables a user account. -----------------------
Const ADS_UF_ACCOUNTDISABLE = 2 Set objUser = GetObject _ ("LDAP://cn=myerken,ou=management,dcúbrikam,dc=com") intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Si on veut passer l'identifiant du compte en paramètre (de la forme cn=xx,ou=xxx,..), on peut modifier le script ainsi :
Const ADS_UF_ACCOUNTDISABLE = 2 Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Et pour l'activer : -----------------
Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) objUser.AccountDisabled = FALSE objUser.SetInfo
Merci Jean Claude, c'est nickel !
-- Erick
Jean-Claude BELLAMY wrote:
Dans le message news:%23PDK$RHVEHA.644@tk2msftngp13.phx.gbl ,
Erick <nospam@nospam> s'est ainsi exprimé:
(une fois décompressé, c'est un fichier .chm bourré d'exemples de
scripts d'administration)
Disables a user account.
-----------------------
Const ADS_UF_ACCOUNTDISABLE = 2
Set objUser = GetObject _
("LDAP://cn=myerken,ou=management,dcúbrikam,dc=com")
intUAC = objUser.Get("userAccountControl")
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
Si on veut passer l'identifiant du compte en paramètre (de la forme
cn=xx,ou=xxx,..), on peut modifier le script ainsi :
Const ADS_UF_ACCOUNTDISABLE = 2
Set Args=wscript.arguments
if args.count=0 then wscript.quit
Set objUser = GetObject("LDAP://" & args(0))
intUAC = objUser.Get("userAccountControl")
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
Et pour l'activer :
-----------------
Set Args=wscript.arguments
if args.count=0 then wscript.quit
Set objUser = GetObject("LDAP://" & args(0))
objUser.AccountDisabled = FALSE
objUser.SetInfo
(une fois décompressé, c'est un fichier .chm bourré d'exemples de scripts d'administration)
Disables a user account. -----------------------
Const ADS_UF_ACCOUNTDISABLE = 2 Set objUser = GetObject _ ("LDAP://cn=myerken,ou=management,dcúbrikam,dc=com") intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Si on veut passer l'identifiant du compte en paramètre (de la forme cn=xx,ou=xxx,..), on peut modifier le script ainsi :
Const ADS_UF_ACCOUNTDISABLE = 2 Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo
Et pour l'activer : -----------------
Set Args=wscript.arguments if args.count=0 then wscript.quit Set objUser = GetObject("LDAP://" & args(0)) objUser.AccountDisabled = FALSE objUser.SetInfo