iis-hero is a CLI management tool for IIS servers. It provides access and management capabilities to remote IIS servers. It supports a wide range of operations for application pools, web sites, applications, and virtual directories. In addition to IIS, it also provides support for Windows services and file operations. You can manage Windows services and perform operations such as file transfer between remote servers.
Assuming that Go is installed, if it is not
Download and install Go.
go install github.com/nub06/iis-hero@latest
Check your $GOPATH/bin
You can rename the binary name if you don't want to use CLI as iis-hero
- login
- profile
- save (Allows you to save the credentials created with the 'iis-hero login' command as a configuration profile)
- use (Allows you to switch between configuration profiles)
- list (List saved configuration profiles)
- current (Display current used configuration profile)
- remove (Remove saved configuration profiles)
- execute (Execute custom powershell commands on target computer)
- start (Start all Internet services on target computer.)
- stop (Stop all Internet services on target computer)
- reset (Stop and then restart all Internet services on the target computer)
- config (Management IIS configuration)
- pool (Manage Application Pools on IIS)
- change (Change the properties of an Application Pool on IIS)
- create (Create an Application Pool on IIS)
- list (List Application Pools and properties on IIS)
- remove (Remove an Application Pool on IIS)
- start (Start the Application Pool on IIS)
- stop (Stop the Application Pool on IIS)
- restart (Restart the Application Pool on IIS)
- state (Display the status of an Application Pool on IIS)
- site (Manage Web Sites on IIS)
- vdir (Manage virtual directories on IIS)
- app (Manage IIS Applications)
- folder (Manage folders on target computer)
- winsvc (Manage Windows Services)
- change (Change the properties of the existing Windows Service)
- create(Create a new Windows Service)
- list (List Windows Service and properties)
- remove (Remove a Windows Service with given name)
- start (Start the Windows Service)
- stop (Stop the Windows Service)
- restart (Restart the Windows Service)
- state (Display the status of a Windows Service)
- If the target computer is already your own computer, you can use
local
orlocalhost
on this command
iis-hero login -c local
iis-hero login -c localhost
- If you have access to the target computer with the same credentials, use this command. It will connect directly with the ComputerName.
iis-hero login -c ComputerName
- If you have access to the target computer with different credentials and WinRM configuration is properly set up, use this command. It will connect to the target computer using the credentials you specify.
iis-hero login -c ComputerName -d Domain -u UserName -p Password
- If you use the --profile flag in the login command and specify a profile name, iis-hero will save your credentials to the profile name you specified and you can switch between these profiles later.
iis-hero login -c ComputerName -d Domain -u UserName -p Password --profile computer1
-
Once you have specified the target computer, it will remain the same until you change it. You don't need to specify it again every time, even if you restart your computer.
-
You can view the credentials used by the application by using the
iis-hero login cred
command. -
Use
iis-hero login cred -f
if you want to view your password without asterisk.
With the latest release of iis-hero, you now have the ability to save multiple sets of credentials as configuration profiles, allowing you to easily switch between these profiles whenever needed.
- Let's say you have a target computer like this
iis-hero login -c ComputerName -d Domain -u UserName -p Password
- Now, suppose you have another target computer like this.
iis-hero login -c ComputerName1 -d Domain1 -u UserName1 -p Password1
- The credentials information for these two target computers can be saved as a profile, so you don't have to enter all the computer details from scratch when you want to use different target computers; let's save the entered information.
iis-hero login -c ComputerName -d Domain -u UserName -p Password
iis-hero profile save profile1
iis-hero login -c ComputerName1 -d Domain1 -u UserName1 -p Password1
iis-hero profile save profile2
- You can enter the profile name as an argument or use the --name flag, you should only use one of them!
iis-hero login -c ComputerName -d Domain -u UserName -p Password
iis-hero profile save --name profile1
iis-hero login -c ComputerName1 -d Domain1 -u UserName1 -p Password1
iis-hero profile save --name profile2
- This command lists saved configuration profiles.
iis-hero profile ls
iis-hero profile list
- This command shows currently used configuration profiles.
iis-hero profile current
-
This command allows you to switch between configuration profiles
-
If you have previously saved a configuration profile with the 'iis-hero profile save' command, you can start using a profile you've saved before with the 'use' command
-
You can enter the profile name as an argument or use the --name flag, you should only use one of them!
iis-hero profile use profile1
iis-hero profile use --name profile1
iis-hero profile use profile2
iis-hero profile current
- This command allows you remove saved configuration profiles
iis-hero profile rm profile1
iis-hero profile ls
- To remove all saved profiles you can use:
iis-hero profile rm -a
iis-hero profile rm --all
iis-hero profile ls
iis-hero profile list
-
Usage:
iis-hero config backup [flags]
iis-hero config backup <foldername> [flags]
iis-hero config backup [command]
-
Available Commands:
- remove Remove IIS configuration backup
-
Flags:
- -h, --help help for backup
-
This command creates a backup folder in the
C:\Windows\System32\inetsrv\backup
-
This command can be used with or without an argument. If you specify a folder name as an argument, it will create a folder with the specified name.
-
If you don't use any argument in this way, it will create a backup folder in the following format.
IISConfigBackup_yyyyMMdd_HHmm
-
Usage example:
iis-hero config backup
iis-hero config backup LastBackup
-
You can provide a folder name as an argument to this command. It deletes the backup file with the name of the folder you entered as an argument. If you want to delete all backups, use the -a, --all flag instead of passing an argument.
-
Usage:
iis-hero config backup remove <foldername> [flags]
-
Aliases:
- remove, rm
-
Flags:
- -a, --all Flag for the remove all backup files
- -h, --help help for remove
-
Usage example:
iis-hero config backup rm LastBackup
iis-hero config backup remove LastBackup
iis-hero config backup rm -a
iis-hero config backup rm --all
-
This command clears all IIS configuration.
-
Usage:
iis-hero config clear [flags]
-
Flags: -h, --help help for clear
-
Usage example:
iis-hero config clear
-
Usage:
iis-hero config restore [flags]
-
Flags:
- -h, --help help for restore
- --latest Restores the most recently created backup file
- --name string Restores the backup file with the specified name
-
Usage example:
iis-hero config restore --latest
iis-hero config restore --name IISConfigBackup_20230425_1148
- If you use this command with the
--latest
flag, it restores the latest backup folder. However, with the--name flag
, you can specify a specific version that you want to restore.
-
This command lists the backup folders that have been previously taken in the
C:\Windows\System32\inetsrv\backup
-
Usage:
iis-hero config list [flags]
-
Aliases:
- list, ls
-
Flags:
- -h, --help help for list
-
Usage example:
iis-hero config ls
iis-hero config list
-
Usage:
iis-hero site change <sitename> [flags]
-
Flags:
- --bind string Set new Binding Value for the Web Site
- -h, --help help for change
- --path string Set new Physical Path Value for the Web Site
- --pool string Set new Application Pool Name for the Web Site
- --preload string Set new PreLoadEnabled Value for the Web Site
- --rename string Rename Web Site
-
You can use all the flags together if you want, or you can only use the flag of the value you want to change.
-
Usage examples:
iis-hero site change MySite --path D:\Applications\MySite
iis-hero site change MySite --path D:\Applications\MySite --pool MyAppPool
iis-hero site change MySite --path D:\Applications\MySite --pool MyAppPool --preload false
iis-hero site change MySite --path D:\Applications\MySite --pool MyAppPool --preload false --bind siteaddress.test
iis-hero site change MySite --pool MyAppPool
-
Usage:
iis-hero site create <sitename> [flags]
-
Flags:
- --bind string Identify Binding Path Value for the Web Site
- -h, --help help for create
- --path string Identify Physical Path Value for the Web Site
- --pool string Identify Application Pool Name for the Web Site
- --preload string Identify PreLoadEnabled Value for the Web Site (default "true")
-
Usage examples:
iis-hero site create NewSite --pool DefaultAppPool --bind testaddress.test --path D:\Application\NewSite
iis-hero site create NewSite --pool DefaultAppPool --bind testaddress.test --path D:\Application\NewSite --preload false
-
Usage:
iis-hero site list [flags]
-
Aliases:
- list, ls
-
Flags:
- -a, --all -a , --all returns all sites
- -h, --help help for list
- -s, --stopped -s, --stopped returns stopped sites
- -n, --name string Specify the name of the website you want to list
-
If you want to list a single web site. Use
-n
flag. -
If you want to list only the running websites, don't use any flag.
-
If you want to list only the stopped websites, use the
-s
flag. -
If you want to list all websites, use the
-a
flag. -
Usage examples:
iis-hero site list
iis-hero site ls -a
iis-hero site ls
iis-hero site list -s
iis-hero site ls -s
iis-hero site list -a
iis-hero site ls -n MySite
iis-hero site ls --name MySite
-
Usage:
iis-hero site remove <sitename>
-
Aliases:
- remove, rm
-
Flags:
- -h, --help help for remove
-
Usage examples:
iis-hero site remove NewSite
iis-hero site rm NewSite
-
Usage:
iis-hero site start <sitename>
-
Flags:
-h, --help help for start
-
Usage examples:
iis-hero site start MySite
-
Usage:
iis-hero site stop <sitename>
-
Flags:
- -h, --help help for stop
-
Usage examples:
iis-hero site stop MySite
-
Usage:
iis-hero site state <sitename>
-
Aliases:
- state, st
-
Flags:
- -h, --help help for state
-
Usage examples:
iis-hero site state MySite
iis-hero site st MySite
-
Usage:
iis-hero pool change <poolname> [flags]
-
Flags:
- --autostart string Set Autostart for application pool
- -h, --help help for change
- --idleaction string Set Idle-Timeout Action for application pool
- --idleminute string Set Idle-Timeout(minutes) for application pool
- --pipeline string Set Managed Pipeline Mode for application pool
- --rename string Set new name for application pool
- --clr string Set Runtime version for application pool
- --startmode string Set Start Mode for application pool
-
You can use all the flags together if you want, or you can only use the flag of the value you want to change.
-
.NETCLR Version ( Runtime version)
-
Use
--clr v2
for.NETCLR Version v2.0
-
Use
--clr v4
for.NETCLR Version v4.0
-
Use
--clr 0
forNo Managed Code
-
Usage examples:
iis-hero pool change MyAppPool --clr 0
iis-hero pool change MyAppPool --idleminute 0
iis-hero pool change MyAppPool --clr v4 --idleminute 0 --pipeline Classic
iis-hero pool change MyAppPool --clr v2 --idleminute 5 --pipeline Integrated --idleaction Suspend
iis-hero pool change MyAppPool --clr 0 --idleminute 20 --pipeline Integrated --idleaction Terminate --autostart false
iis-hero pool change MyAppPool --clr 0 --idleminute 20 --pipeline Integrated --idleaction Terminate --autostart false --startMode OnDemand
-
Usage:
iis-hero pool create <poolname> [flags]
-
Flags:
- --autostart string Set Autostart for application pool (default "true")
- -h, --help help for create
- --idleaction string Set Idle-Timeout Action for application pool (default "Suspend")
- --idleminute string Set Idle-Timeout(minutes) for application pool (default "0")
- --pipeline string Set Managed Pipeline Mode for application pool (default "Integrated")
- --clr string Set Runtime version for application pool e.g: --clr v4, --runtime v2 (default: "No Managed Code")
- --startmode string Set Start Mode for application pool (default "AlwaysRunning")
-
.NETCLR Version ( Runtime version)
-
Use
--clr v2
for.NETCLR Version v2.0
-
Use
--clr v4
for.NETCLR Version v4.0
-
Use
--clr 0
forNo Managed Code
-
Usage examples:
iis-hero pool create NewAppPool
iis-hero pool create NewAppPool --startmode OnDemand
iis-hero pool create NewAppPool --startmode OnDemand --clr v4
iis-hero pool create NewAppPool --clr v2 --idleaction 5
-
Usage:
iis-hero pool list [flags]
-
Aliases:
- list, ls
-
Flags:
- -a, --all List all application pools
- -h, --help help for list
- -s, --stopped List only stopped application pools
-
If you want to list only the running application pools, don't use any flag.
-
If you want to list only the stopped application pools, use the
-s
flag. -
If you want to list all application pools, use the
-a
flag. -
Usage examples:
iis-hero pool list
iis-hero pool list -s
iis-hero pool list -a
iis-hero pool ls -a
iis-hero pool ls -s
iis-hero pool ls
-
Usage:
iis-hero pool remove <poolname> [flags]
-
Aliases:
- remove, rm
-
Flags:
- -f, --force Force flag to delete an Application Pool
- -h, --help help for remove
-
If there is a Web Site belonging to the Application Pool that you want to delete, but you still want to delete you should use the
--force
flag to delete that Application Pool. -
Usage examples:
iis pool remove NewAppPool
iis pool remove NewAppPool -f
- Usage:
iis-hero pool start <poolname>
- Flags:
- -h, --help help for start
- Usage examples:
iis-hero pool start MyAppPool
-
Usage:
iis-hero pool stop <poolname>
-
Flags:
- -h, --help help for stop
-
Usage examples:
iis-hero pool stop MyAppPool
-
Usage:
iis-hero pool restart <poolname>
-
Aliases:
- restart, reset
-
Flags:
- -h, --help help for restart
- -a, --all Restart all Application Pools
-
Usage example:
iis-hero pool restart MyAppPool
iis-hero pool restart -a
iis-hero pool reset -a
-
Usage:
iis-hero pool state <poolname>
-
Aliases:
- state, st
-
Flags:
- -h, --help help for state
-
Usage example:
iis-hero pool state MyAppPool
iis-hero pool st MyAppPool
-
Usage:
iis-hero vdir change <name> [flags]
-
Flags:
- --path string Set a new Physical Path Value for the Virtual Directory
- --rename string Set a new Name Value for the Virtual Directory
-
You can use all the flags together if you want, or you can only use the flag of the value you want to change.
-
Usage examples:
iis-hero vdir change MyVirtualDirectory --path D:\Applications\MyVDir
iis-hero vdir change MyVirtualDirectory --rename MyNewVDir
- Usage:
iis-hero vdir create <name> [flags]
- Flags:
- -h, --help help for create
- --path string Identify Physical Path Value for the Virtual Directory
- --site string Identify Web Site Name Value for the Virtual Directory
- Usage examples:
iis-hero vdir create NewVirtualDirectory --site MyWebSite --path D:\Application\NewVirtualDir
-
Usage:
iis-hero vdir list [flags]
-
Flags:
- -h, --help help for list
-
Usage example:
iis-hero vdir list
-
Usage: -
iis-hero vdir remove <name> [flags]
-
Aliases:
- remove, rm
-
Flags:
- -h, --help help for remove
- --site string Specify the Web Site Name of the Virtual Directory
- --app string Specify the Application Name of the Virtual Directory
If you don't specify the Site and Application, the iis-hero will automatically search and delete the Virtual Directory you specified with <name>
. However, if there are multiple virtual directories with the same name on the IIS server, the cli will prompt you to specify the Site and Application name of the Virtual Directory you want to delete using the --site
and --app
flags.
- Usage examples:
iis-hero vdir remove NewVirtualDirectory --site MyWebSite
iis-hero vdir remove NewVirtualDirectory
iis-hero vdir rm NewVirtualDirectory --site NewWebsite
iis-hero vdir rm NewVirtualDirectory --site NewWebsite --app MyApp
- If you do not specify a site with the
--site
flag, the CLI will search for the site of the application you specified as<application name>
. If it cannot find it, it will show you a warning. In that case, use the--site
flag to specify the site name.
-
Usage:
iis-hero app change <application name> [flags]
-
Flags:
- -h, --help help for change
- --path string Set a new Physical Path for Application
- --pool string Set a new Application Pool for Application
- --preload string Set a PreloadEnabled value for Application
- --rename string Set a new name for Application
- --site string Identify Site Name of the Application
-
Usage example:
iis-hero app change MyApp --pool NewAppPool
iis-hero app change MyApp --pool NewAppPool2
iis-hero app change MyApp --rename MyApplication --site NewWebSite
-
Usage:
iis-hero app create <application name> [flags]
-
Flags:
- -h, --help help for create
- --path string Identify Physical Path for Application
- --pool string Identify Application Pool for Application
- --site string Identify Site Name for Application
-
Usage example:
iis-hero app create NewApp --pool NewAppPool --site NewWebSite --path D:\NewApp
-
If you want to delete an application, use the
iis-hero app remove
command. If this application contains other applications, the application will give you an error message stating that it has sub-applications. If you still want to delete it, use the force flag.iis-hero app remove -f
If you use this flag, the specified application and all applications contained within it will be deleted." -
Usage:
iis-hero app remove <application name> [flags]
-
Aliases:
- remove, rm
-
Flags:
- -f, --force Force flag for the Remove Application
- -h, --help help for remove
- --site string Identify Site Name for Application
-
Usage example:
iis-hero app remove MyApp -f
iis-hero app rm MyApp --force
iis-hero app rm MyApp
-
Usage:
iis-hero app list [flags]
-
Flags:
- -h, --help help for list
-
Usage example:
iis-hero app ls
iis-hero app list
- When specifying the
<servicename>
parameter in all commands except for thecreate
command, you can use either the service name or the display name as the value.
- Usage :
iis-hero winsvc change <servicename> [flags]
- Usage examples:
iis-hero winsvc change MyWinService --description "New Description of NewWinService" --displayname "New Win Service"
iis-hero winsvc change MyWinService --description "New Description of NewWinService" --startup Automatic
iis-hero winsvc change MyWinService --description "New Description of NewWinService" --startup Automatic --rename RenamedWinService
- Flags:
- --description string Set new Description value for Windows Service
- --displayname string Set new DisplayName value for Windows Service
- --exepath string Set new Executable Path value for Windows Service
- -h, --help help for change
- --startup string Set new StartupType value for Windows Service
-
The
<service name>
parameter corresponds to the service name value of the Windows service that will be created. -
Usage
iis-hero winsvc create <servicename> [flags]
-
Usage examples:
iis-hero winsvc create NewWinSvc --displayname "New Win Svc" --exepath "D:\Application\MyWinSvc\mysvc.exe"
iis-hero winsvc create NewWinSvc --displayname "New Win Svc" --description "The service is used for MyApp" --exepath "D:\NewWinSvc\mysvc.exe"
iis-hero winsvc create NewWinSvc --displayname "New Win Svc" --description "The service is used for MyApp" --exepath "D:\NewWinSvc\mysvc.exe" --startup Automatic
iis-hero winsvc create MyWinService --exepath "D:\NewWinSvc\mysvc.exe"
- Usage:
iis-hero winsvc remove <servicename> [flags]
- Aliases:
- remove, rm
- Flags:
- -h, --help help for remove
- Usage examples:
iis-hero winsvc remove MyWinService
iis-hero winsvc rm "My Win Service"
-
Usage:
iis-hero winsvc stop <servicename> [flags]
-
Flags:
- -h, --help help for stop
-
Usage examples:
iis-hero winsvc stop MyWinService
-
Usage:
iis-hero winsvc start <servicename> [flags]
-
Flags:
- -h, --help help for start
-
Usage examples:
iis-hero winsvc start MyWinService
-
Usage:
iis-hero winsvc restart <servicename> [flags]
-
Aliases:
- restart, reset
-
Flags:
- -h, --help help for restart
-
Usage examples:
iis-hero winsvc restart MyWinService
-
Usage:
iis-hero winsvc list <servicename> [flags]
-
Aliases:
- list, ls
-
Flags:
- -h, --help help for list
-
Usage examples:
iis-hero winsvc list MyWinService
iis-hero winsvc ls MyWinService
-
Usage:
iis-hero winsvc state <servicename> [flags]
-
Flags:
- --h, --help help for state
-
Usage examples:
iis-hero winsvc state MyWinService
-
This command takes a backup of a specified folder on the target computer. If you use the
--dest
flag to specify a path, it creates a backup folder at the specified path. If you don't use this flag, it will create a backup at the default path ofD:\Backups.
-
Usage:
iis-hero folder backup <source folder path> [flags]
-
Flags:
- -h, --help help for backup
- -d, --dest string Specify backup folder destination (default "D:\Backups")
-
Usage example:
iis-hero folder backup D:\MyApplication
iis-hero folder backup D:\MyApplication --dest D:\NewFolder
-
Usage:
iis-hero folder list <folderpath> [flags]
-
Aliases:
- list, ls
-
Flags:
- -h, --help help for list
-
Usage example:
iis-hero folder ls D:\MyApplication
iis-hero folder list D:\MyApplication
-
This command performs file copying from your local computer to the target computer. Use the
--local
flag to specify the location of the folder you want to copy on your local computer, and use the--target
flag to specify the destination where you want to copy the file on the target computer. -
Usage:
iis-hero folder push [flags]
-
Flags:
- -h, --help help for push
- --local string Specify file/folder path on local computer
- --target string Specify destination folder path on target computer
-
Usage example:
iis-hero folder push --local D:\Folder --target D:\DestFolder
iis-hero folder push --local D:\try.txt --target D:\DestFolder
-
This command performs file copying from your target computer to the local computer. Use the
--target
flag to specify the location of the folder you want to copy on your target computer, and use the--local
flag to specify the destination where you want to copy the file on the local computer. -
Usage:
iis-hero folder pull [flags]
-
Flags:
- -h, --help help for push
- --local string Specify destination folder path on local computer
- --target string Specify file/folder path on target computer
-
Usage example:
iis-hero folder pull --local D:\LocalDestFolder --target D:\DestFolder
iis-hero folder pull --local D:\LocalDestFolder --target D:\hero.json