脚本编程与Active Directory监控全解析
1. 脚本处理命令行参数
在脚本编程中,处理命令行参数是一项重要技能。以下是一个重置用户密码的脚本示例:
Set Arguments = New ArgumentsClass
If Not(Arguments.RequiredArgumentsExist(“User”)) Then
WScript.Echo “Missing a required argument!”
‘ Display the proper syntax message here
WScript.Quit(1)
End If
Satisfied that we have the required argument, we can move on. The UserObject is created and
bound to the specified argument.
UserObject.BindToUser Arguments.GetArgument(“User”)
Finally we reset the password. Because the Password argument is optional we need to check for
its existence. If it wasn’t passed on the command line we’ll use the default password value.
If Arguments.ArgumentExists(“Password”) Then
UserObject.Password = _
超级会员免费看
订阅专栏 解锁全文
75

被折叠的 条评论
为什么被折叠?



