Problem with Entering Credentials to the Windows Credential Manager via Intune
Hi All,
I have been trying to get the following script to work to enter “Windows Credentials”, not “Generic” credentials into the Windows Credential Manager via Intune Win32 App. It says successfully installed on my Win32 Apps page of Intune, but never adds the credentials. This is the script:
——————————————————-
# Define the credentials
$target = “10.10.10.10”
$username = “testname”
$password = “testpassword”
# Convert the password to a secure string
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
# Create the credential object
$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)
# Add the Windows credential to the Credential Manager
cmdkey /add:$target /user:$username /pass:$password
Write-Output “Windows credential added successfully.”
————————————————————————-
I use the following “Custom” detection rule script:
# Define the target name for the credential
$target = “10.10.10.10”
# Check if the credential exists
$credential = cmdkey /list | Select-String -Pattern $target
if ($credential) {
Write-Output “Credential exists”
exit 0
} else {
Write-Output “Credential does not exist”
exit 1
}
—————————————————————
I use the following “Install Command” to run the install of App:
powershell.exe -ExecutionPolicy Bypass -File .Windows_Creds.ps1
Cannot figure out why it won’t write the credentials. I can get other scripts to make “Generic” easily, but cannot get it to create a set of “Windows Credentials”. Any help would be appreciated.
Thank you,
Intuneme
Hi All,I have been trying to get the following script to work to enter “Windows Credentials”, not “Generic” credentials into the Windows Credential Manager via Intune Win32 App. It says successfully installed on my Win32 Apps page of Intune, but never adds the credentials. This is the script:——————————————————-# Define the credentials$target = “10.10.10.10”$username = “testname”$password = “testpassword”# Convert the password to a secure string$securePassword = ConvertTo-SecureString $password -AsPlainText -Force# Create the credential object$credential = New-Object System.Management.Automation.PSCredential($username, $securePassword)# Add the Windows credential to the Credential Managercmdkey /add:$target /user:$username /pass:$passwordWrite-Output “Windows credential added successfully.”————————————————————————-I use the following “Custom” detection rule script: # Define the target name for the credential$target = “10.10.10.10”# Check if the credential exists$credential = cmdkey /list | Select-String -Pattern $targetif ($credential) {Write-Output “Credential exists”exit 0} else {Write-Output “Credential does not exist”exit 1}————————————————————— I use the following “Install Command” to run the install of App: powershell.exe -ExecutionPolicy Bypass -File .Windows_Creds.ps1 Cannot figure out why it won’t write the credentials. I can get other scripts to make “Generic” easily, but cannot get it to create a set of “Windows Credentials”. Any help would be appreciated. Thank you,Intuneme Read More