r/PowerShell • u/FeelingDevDesign • Nov 19 '25
Independent script with administrator rights
Dear community,
I am supposed to take over IT support for a small association. Since there is unfortunately no option for LDAP, I have considered creating a kind of “workaround” to enable uniform passwords on multiple computers.
A Powershell script regularly checks (e.g., upon login) whether a password hash is still the same. If the hashes are not the same, the script should automatically retrieve the new password from a database and set it for the account.
The script must therefore run as an administrator (even if the account is a normal user). Ideally, it should even run independently of the account directly at startup. Since I have little experience with Powershell so far, I wanted to ask how I can get the script to run as an administrator or, if possible, independently of the account.
PS: I know this isn't the best or safest method, but it should solve a lot of problems for now.
25
u/purplemonkeymad Nov 19 '25
Oh man, please don't re-implement workgroups.
In general I would really strongly suggest to use a IdP such as Ad, EntraId or google workspaces.
Business Basic license are quite cheap (or free for non-profits) and means you can entra join the devices. (You can set local admins and use LAPS.) Obviously Intune will be better, but if you can't afford that at least join them so you don't have to care about passwords being in sync.
5
u/TypaLika Nov 19 '25
Just because you can do something, doesn't mean you should.
1
u/pigers1986 Nov 19 '25
Why not enforce password change every 180 days with some complexities like small letter,big letter and some special char , at least 14 chars ? That will be uniform.
3
u/AnonEMoussie Nov 19 '25
Don’t ever get a third party to review your security, or licensing. That can be business level issues. Even if you’re working for a church or non-prophet.
1
u/gramsaran Nov 19 '25
What's your NAS situation? You could also drop on a Synology that has LDAP server Support.
1
u/KR4N1X Nov 20 '25
I achieved running powershell scripts as admin on a regular user account by running it as a scheduled task with elevated privileges
1
u/thanatossassin Nov 21 '25
This is a job I would walk away from if they're not going to take your recommendations seriously. I wouldn't kowtow to their self induced limitations; get used to the way things need to be, or prepare to suffer dire consequences in terms of ransomware or other malicious attacks, because then they'll be calling you back with no choice but to spend money, or fold.
Unless you work for an MSP and don't have any say in the matter.
1
u/Ok_Mathematician6075 Nov 26 '25
LDAP?
-1
u/schnitzeljaeger Nov 19 '25
Do they need Windows? If not, that opens up endless possibilities using Linux ;-)