Hi,
If it’s a Windows Virtual Machine you could use PowerCLI cmdlet's to achieve this using the
Copy-VMGuestFile and Invoke-VMScript cmdlet's with a script similar to https://gallery.technet.microsoft.com/Reset-Local-Administrator-e3023c3a and a code similar to:
[string] $strvCenter = "labvc1.pigeonnuggets.com"
Connect-VIServer $strvCenter
$guestCredentials = Get-Credential # The Credentials for the guest machine
Copy-VMGuestFile -Source c:\_admin\PasswordReset.ps1 -Destination c:\temp\PasswordReset.ps1 -VM VM -LocalToGuest -GuestCredential $guestCredentials
$ResetPassword = (Invoke-VMScript -VM $vm -ScriptText ".\c:\temp\PasswordReset.ps1 -newpassword XXXXXXXXX" -GuestCredential $guestCredentials -WarningAction SilentlyContinue).ScriptOutput
Kind regards,
Adrian
Please consider marking this answer "correct" or "helpful" if you think your query have been answered correctly.
Cheers,