Password lost OPEN PDC configurator

Hello everyone, I have a pdc installed on a virtual machine and the configurator access password was lost, is there any solution to recover this password?

Hello Luiz,

What is the configurator? Are you talking about the openPDC Manager?

Thanks,
Stephen

Yes, and the password is to log into openPDCManger.

Luiz Barreto

Run the following script in PowerShell, and it will provide instructions for how to add the user that is currently logged into your system as an administrator in openPDC Manager.

$sid = $(whoami /user | select -last 1).Split(' ')[1]

Write-Host
Write-Host "Run the following queries against your openPDC database"

Write-Host
Write-Host "INSERT INTO UserAccount(Name, DefaultNodeID, UseADAuthentication)"
Write-Host "VALUES('$sid', (SELECT TOP 1 ID FROM Node), 1)"

Write-Host
Write-Host "INSERT INTO ApplicationRoleUserAccount(ApplicationRoleID, UserAccountID)"
Write-Host "VALUES((SELECT ID FROM ApplicationRole WHERE Name = 'Administrator'), (SELECT ID FROM UserAccount WHERE Name = '$sid'))"
1 Like

HI
After running the script it will only return the following message.

Based on your screenshot, here’s what your output should look like.

Run the following queries against your openPDC database

INSERT INTO UserAccount(Name, DefaultNodeID, UseADAuthentication)
VALUES('S-1-5-21-13536531-4236762608-2840861628-500', (SELECT TOP 1 ID FROM Node), 1)

INSERT INTO ApplicationRoleUserAccount(ApplicationRoleID, UserAccountID)
VALUES((SELECT ID FROM ApplicationRole WHERE Name = 'Administrator'), (SELECT ID FROM UserAccount WHERE Name = 'S-1-5-21-13536531-4236762608-2840861628-500'))

hey
Sorry for my low knowledge of PowerShell, when I updated the script with this command I got the following response.

I guess it’s because you didn’t run it as a script. But it doesn’t matter. I already posted the output in my previous message. You just need to follow the instructions at this point. Run the two INSERT statements against your openPDC database, and it should grant you access via openPDC Manager.

Hello again,

Execute the two INSERT statements in the openPDC database and I was not successful, not even a response.

Your screenshot indicates that you are connected to a transient in-memory database, and also that you haven’t executed the INSERT statements. If your openPDC is using a SQLite database, you need to find the path to the .db file it’s using and run sqlite3 C:\path\to\openPDC.db to connect to the openPDC database. Then you can paste the INSERT statements into the console to run them against that database. Make sure you add a semicolon to the end of each INSERT statement.

If you don’t know where your .db file is, you need to find your installation of openPDC. By default, it gets installed to C:\Program Files\openPDC. In that location, there should be a file called openPDC.exe.config. Open this file in your favorite text editor and look for the ConnectionString setting. The value of this setting should contain the path to your .db file.

Hi Stephen,

I imagine I made some progress, but the following error is occurring as shown in the print.

Thanks in advance for the quick help.

Oh, sorry about that. I didn’t realize I had used syntax specific to SQL Server. The first query should look like this.

INSERT INTO UserAccount(Name, DefaultNodeID, UseADAuthentication)
VALUES('S-1-5-21-13536531-4236762608-2840861628-500', (SELECT ID FROM Node LIMIT 1), 1);

If that doesn’t work, you can try this.

INSERT INTO UserAccount(Name, DefaultNodeID, UseADAuthentication)
VALUES('S-1-5-21-13536531-4236762608-2840861628-500', (SELECT ID FROM Node), 1);

The second query should succeed if you run it after the first query does.

Ok Stephen you are the best, finally working!!!

When you come to Manaus - Amazonas to visit our plant, you will be very welcome!


1 Like