is any way in MEM Portal to use user accout as varibale in script

Richkm 146 Reputation points
2022-02-22T08:46:13.783+00:00

Hello Expert,
I need to rename a computer that is hybrid autopilot device using script deployment but current I am using account credential for this in script. like below
$password = ConvertTo-SecureString "Password" -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential ("abc\admin", $password)
Rename-Computer -ComputerName "localhost" -NewName $newname -DomainCredential $Cred -Force
is there any way to use domain user account as variable in script so I don't need to provide password in script. any way intune...otherwise I will look on scripting view to change it .

Thank
rich

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,782 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,654 questions
{count} votes