【问题标题】:Validate Service Account Powershell验证服务帐户 Powershell
【发布时间】:2011-03-24 23:24:30
【问题描述】:

我想编写一个 Powershell 脚本来验证我的 AD 团队提供给我的大量服务帐户。并不是说我不信任他们,而是我想循环浏览每个域用户名和密码,看看它是登录还是失败。到目前为止,我正在寻找一些建议,但我的尝试都失败了(请参阅帖子 http://tjo.me/fKtvPM)。

谢谢

附:我无权访问 AD,因此我必须尝试使用​​凭据登录进行测试。

【问题讨论】:

    标签: powershell active-directory


    【解决方案1】:

    这真的很hacky(对于最低特权模型来说很难看),但是如果您知道所有服务帐户都可以访问特定程序/文件,您可以尝试使用他们的凭据启动一个进程。

    $cred = get-credential # however you're getting the info from AD team, pass it hear to get-credential
    start-process powershell -argumentlist "-command","exit" -cred (get-credential)
    $? # if $true, process started (and exited) successfully, else failed (either bad creds or account can't access powershell.exe
    

    不幸的是,由于您不能直接查询 AD,我认为任何解决方案都会有点麻烦,因为根据定义,您将不得不模拟以用户帐户身份登录。

    【讨论】:

    • 这行得通,但它不像我希望的那样健壮。我还需要遍历一大堆帐户。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-05
    • 1970-01-01
    • 1970-01-01
    • 2019-01-23
    • 1970-01-01
    • 2018-11-21
    • 2020-04-15
    相关资源
    最近更新 更多