Created
November 24, 2022 09:09
-
-
Save sannae/fd9a42c91f6aa075f6242880cfbe0808 to your computer and use it in GitHub Desktop.
Gets all the services and web application whose physical path resides in a specific root folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$RootFolder = "ROOT_FOLDER_NAME" | |
# Services whose path contains $RootFolder | |
Get-CimInstance -ClassName Win32_service | Where-Object {$_.PathName -like "*$RootFolder*"} | Format-Table | |
# Web application whose physical path contains $RootFolder | |
$(Get-IISServerManager).Sites["Default Web Site"].Applications | Where-Object {$_.VirtualDirectories.PhysicalPath -like "*$RootFolder*"} | Format-Table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment