zoukankan      html  css  js  c++  java
  • 学习:MOSS里出现登陆时,只有系统帐户可用,其他帐户都登陆不了的问题:Fix those SIDs(转)

    Fix those SIDs

    (I'm not sure why this isn't showing up under my blog, but I'm working on it!)

    Thanks to my good friend Jeremy McMahan for finding the suser_sid() function for me -- My original solution was a crazy mix of linked servers and the Directory Services provider for OLEDB!

    Ever migrate your SharePoint site to a totally new environment and discover that your efforts to re-create your Active Directory were all for nothing, since all the users got new SIDs?  Symptoms like: The administrator of the server can log in, but nobody else can, even though you're SURE their usernames and passwords are right.

    Here's a script that'll fix that up for you in a jif.  Open Query Analyzer and run it against the content database for your site, and it will update all the SIDs for your users to the SID that is reported for that user by Active Directory.

    Big fat disclaimer: Microsoft does NOT support ANY modifications to your SharePoint databases.  That's not to say they won't support your SharePoint site, but if this operation breaks your server, Microsoft won't help you.  I'm not responsible for the results, either, while we're on the subject of passing the buck.  BACK UP YOUR DATABASE.

    Okay, now that we've gotten that mumbo-jumbo out of the way, here's the code.

     

     

    DECLARE @login varchar(40), @systemid varbinary(128)

     

    DECLARE curUsers CURSOR LOCAL FOR

    SELECT tp_login, tp_systemid FROM userinfo where tp_deleted = 0

     

    OPEN curUsers

     

        FETCH NEXT FROM curUsers INTO @login, @systemid

     

    WHILE @@FETCH_STATUS = 0

    BEGIN

        PRINT 'Resetting user ' + @login + ' to new SID '

        PRINT suser_sid(@login)

        UPDATE UserInfo

           SET tp_systemid = suser_sid(tp_login) WHERE CURRENT OF curUsers

        FETCH NEXT FROM curUsers INTO @login, @systemid

    END

     

    CLOSE curUsers

    DEALLOCATE curUsers

     

    GO

     

    文章出自:http://www.sharepointblogs.com/dustin/archive/2004/09/10/756.aspx 

     

  • 相关阅读:
    [leetcode-604-Design Compressed String Iterator]
    [leetcode-617-Merge Two Binary Trees]
    OpenCV学习1-----打开摄像头并在画面上添加水印
    cvCvtColor与cvtColor区别
    [leetcode-547-Friend Circles]
    [leetcode-260-Single Number III]
    复位电路
    单片机特殊功能寄存器
    单片机的定时器与计数器
    单片机定时/计数工作方式
  • 原文地址:https://www.cnblogs.com/LeimOO/p/1422155.html
Copyright © 2011-2022 走看看