How to change local administrator password

Hi everybody

I want to know if somebody can help me to write a script which will force an administrator to change a local administrator password without known the older password.

Thank’s :slight_smile: .

something like this

$user = [adsi]"WinNT://$ComputerName/$username"
$user.SetPassword($Password)
# may be it is needed too, can't remember. Or it need only for various user parameters
# $user.SetInfo()

Thank’s. But when I try this, it’s ask me the older password. Is it possible to change the password without knowing the older?

Thank’s and excuse me for my poor english :slight_smile:

If maintaining local admin passwords is your goal I recommend LAPS. Easy to setup and it works great in my experience.

Thank’s for your reply.

But my goal is to use powershell to force a user to change the local administrator password without knowing the older.
In fact, our VM machines when they are build are not directly in a domain. We use IaaS in fact. so the blueprint just have an account (local administrator), and i want with a powershell script to force user to change the password without knowing the older. I want to be the only to keep this old password.

PS: Excuse me again for my poor english.

Thanks everybody

May be you non-admin on comoputer where you try to change password ? It never ask me