Trying to change the Intune Local admin password on a Managed Device

JKFrancis 81 Reputation points
2023-02-02T16:06:38.0566667+00:00

Trying to change the Local admin password through Powershell script as mentioned here by Crystal-MSFT but it does not work. I am using this to run it as a Powershell script in Intune to change it on the device. I did set it up as mentioned in this link, but it does not seem to work any suggestions Crystal or someone else.

$Password = ConvertTo-SecureString "Password value" -AsPlainText -Force

$UserAccount = Get-LocalUser -Name "admin"

$UserAccount | Set-LocalUser -Password $Password

https://learn.microsoft.com/en-us/answers/questions/608549/change-local-admin-password-from-intune?page=1&orderby=helpful&comment=answer-608764#newest-answer-comment

Microsoft Security Intune Configuration
Windows for business Windows Client for IT Pros User experience Other
Microsoft Security Intune Other
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,751 Reputation points
    2023-02-03T17:23:18.13+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.

    If the script mentioned by Crystal-MSFT isn't working for you, there could be several reasons why:

    1. User account control: UAC can interfere with the execution of PowerShell scripts and prevent you from changing the local admin password. Try running the script as an administrator.
    2. Permissions: Ensure that the account you are using to run the script has the necessary permissions to change the local admin password.
    3. Execution policy: The execution policy in PowerShell can prevent scripts from running. You can check the current execution policy by running the following command: Get-ExecutionPolicy. You can set the execution policy to "Unrestricted" by running the following command: Set-ExecutionPolicy Unrestricted.
    4. Syntax: Ensure that the script syntax is correct and that you are using the correct syntax for the version of PowerShell you are running.

    It's also a good idea to double-check the script and make sure it's suitable for your needs and requirements.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.