trtkron Posted June 27, 2007 Share Posted June 27, 2007 (edited) The MS documentation is super poor. They call it a direct replacement and then the only example they cite using it... is delete. Has anyone gotten it to work like MoveUser?I'm refering to this. http://support.microsoft.com/kb/930955 Edited June 27, 2007 by trtkron Link to comment Share on other sites More sharing options...
tap52384 Posted June 27, 2007 Share Posted June 27, 2007 maybe this will help:http://www.kbalertz.com/Q118510/Microsoft....ion.Update.aspx Link to comment Share on other sites More sharing options...
trtkron Posted June 27, 2007 Author Share Posted June 27, 2007 (edited) If anyone else needs it, I finally got something working.Set oShare = GetObject("winmgmts:\\.\root\CIMV2").Get("Win32_UserProfile.SID=""" & sSIDLocal & """")Set oInParam = oShare.Methods_("ChangeOwner").InParameters.SpawnInstance_()oInParam.Properties_.Item("Flags") = 0oInParam.Properties_.Item("NewOwnerSID") = sSIDDomainSet oOutParams = GetObject("winmgmts:\\.\root\CIMV2").ExecMethod("Win32_UserProfile.SID=""" & sSIDLocal & """", "ChangeOwner", oInParam)After that, to make it 'just like' MoveUser (at least how I use it here), delete the local account.Set oAccount = GetObject("winmgmts:\\.\root\cimv2:Win32_UserAccount.Name=""" & sLocalUserID & """")Set oUserProfile = GetObject("winmgmts:\\.\root\cimv2:Win32_UserProfile.SID='" & oAccount.SID & "'")If MsgBox("Are you sure you want to delete " & frmMain.cmbLocalUserID.Text, vbYesNo) = vbYes Then oUserProfile.Delete_End If Edited June 27, 2007 by trtkron Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now