Monday, December 18, 2017
Tuesday, December 12, 2017
Powershell Set IIS apppool custom identity credential
import-module webadministration
function Set-WebsiteAppPoolCustomIdentity([String] $appPoolName, [String] $userId, [String] $pwd)
{
Write-Host $appPoolName;
$webAppPool = get-item IIS:\AppPools\$appPoolName
$webAppPool.processModel.userName = $userId;
$webAppPool.processModel.password = $pwd;
$webAppPool.processModel.identityType = 3;
$webAppPool | Set-Item
$webAppPool.Stop();
$webAppPool.Start();
Write-Host "IIS Recycled";
$webAppPool = get-item iis:\apppools\$appPoolName;
write-host "New Pool User: " $webAppPool.processModel.userName;
write-host "New Pool PWd: " $webAppPool.processModel.password;
}
Set-WebsiteAppPoolCustomIdentity -appPoolName "abc" -userId "hello" -pwd "world"
function Set-WebsiteAppPoolCustomIdentity([String] $appPoolName, [String] $userId, [String] $pwd)
{
Write-Host $appPoolName;
$webAppPool = get-item IIS:\AppPools\$appPoolName
$webAppPool.processModel.userName = $userId;
$webAppPool.processModel.password = $pwd;
$webAppPool.processModel.identityType = 3;
$webAppPool | Set-Item
$webAppPool.Stop();
$webAppPool.Start();
Write-Host "IIS Recycled";
$webAppPool = get-item iis:\apppools\$appPoolName;
write-host "New Pool User: " $webAppPool.processModel.userName;
write-host "New Pool PWd: " $webAppPool.processModel.password;
}
Set-WebsiteAppPoolCustomIdentity -appPoolName "abc" -userId "hello" -pwd "world"
Subscribe to:
Posts
(
Atom
)