IIS PowerShell Application Pool set as 'NetworkService' Account
Asked Answered
L

1

7

I'm trying to create an Application Pool in IIS7 using PowerShell. I want this to run under the NetworkService account but currently this appears to try and set itself as an 'Other' user on the Application Pool rather than being recognised as a built-in account. My PS looks like this currently: Set-ItemProperty $iisAppPoolDir -name processModel -value @{userName="NetworkService";identitytype=3}

Now this usually should also have the password="*****"; field available to allow me to create the application pool and have the user log in. I've left this out, hoping it would be identifiable, but it's not worked.

Any help appreciated!

Laevorotatory answered 10/3, 2015 at 14:16 Comment(0)
S
19

Network Service is its own identityType, so you would not set a username at all, and instead set the identityType to 2, like this:

Set-ItemProperty IIS:\AppPools\MyAppPool -name processModel.identityType -value 2

This will set the identity to Network Service.

The identityType values are documented on the IIS website.

Seldom answered 10/3, 2015 at 14:26 Comment(2)
Brilliant, thank you. I'm assuming that I'm using the wrong identifier with 3 and this is expecting a Windows or Domain account.Laevorotatory
Correct - 3 means "custom identity".Seldom

© 2022 - 2024 — McMap. All rights reserved.