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

JKFrancis 76 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

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,674 questions
Microsoft Intune Configuration
Microsoft Intune Configuration
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Configuration: The process of arranging or setting up computer systems, hardware, or software.
1,729 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,375 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 43,956 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