Looking for help on how to set the IIS website - NOT application pool - identity fields via the PowerShell WebAdministration module. I have many IIS servers (with many web sites on each) that need to have their passwords reset.
Here's where the identity fields would be set manually
I already have the commands needed to modify the application pool identity, but I cannot find anything on modifying the website identity fields.
TIA.
Welcome, SamJ! Have you tried something like this script?
$iisSitePath = "IIS:\Sites\" + $siteName
$website = get-item $iisSitePath
$website.virtualDirectoryDefaults.userName = "domain\username"
$website.virtualDirectoryDefaults.password = "password"
$website | set-item
Found on this blog
There's also an option to poke XML into the applicationhost.config file:
Set-WebConfiguration -Filter "/system.applicationHost/sites/site[@name='Test']/application[@path='/']/virtualDirectory[@path='/']" -Value @{userName='DOMAIN\TestUser'; password='Pa55word'}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.