Sunday, July 3, 2011

Find your SID

If you restore the demodatabase for an AX 2012 image, you might need to know you SID in order to change your login in the AX database.

This vbs script displays your SID and copies it to your clipboard:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set objAccount = objWMIService.Get _
Wscript.Echo objAccount.SID

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c echo " + objAccount.SID + " | clip", 0, TRUE

Wscript.Echo "Your SID is copied to the  clipboard"
You may need to change the values for the user account name and the domain.

And this is the script you can use in the database:
update userinfo
networkdomain = 'YourDomain',
networkalias = 'YourAlias',
SID = 'YourSID'
where ID = 'Admin'

1 comment:

Palle Agermark said...

I have today learned that you can just write "whoami /user" in a command prompt, to get your user name and SID.