{"id":27861183,"url":"https://github.com/mscholtes/webserver","last_synced_at":"2025-05-04T18:32:40.167Z","repository":{"id":114051021,"uuid":"269360438","full_name":"MScholtes/WebServer","owner":"MScholtes","description":"Powershell WebServer is a Powershell module that starts a webserver (without the need for IIS)","archived":false,"fork":false,"pushed_at":"2024-02-03T16:56:10.000Z","size":316,"stargazers_count":67,"open_issues_count":0,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-02-03T18:01:03.305Z","etag":null,"topics":["powershell-webserver","webserver"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MScholtes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-04T12:59:33.000Z","updated_at":"2023-12-11T07:55:34.000Z","dependencies_parsed_at":"2023-06-19T03:46:37.978Z","dependency_job_id":null,"html_url":"https://github.com/MScholtes/WebServer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FWebServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FWebServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FWebServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MScholtes%2FWebServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MScholtes","download_url":"https://codeload.github.com/MScholtes/WebServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252382310,"owners_count":21739130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["powershell-webserver","webserver"],"created_at":"2025-05-04T18:32:39.566Z","updated_at":"2025-05-04T18:32:40.150Z","avatar_url":"https://github.com/MScholtes.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Powershell Webserver\nPowershell WebServer is a module that starts a webserver (without the need for IIS). Powershell command execution, script execution, upload, download and other functions are implemented.\n\nPowershell WebServer is  is primarily intended as an example or base for own development. No multi threading, only one client at a time!\n\nSee Script Center version: [Powershell Webserver](https://github.com/MScholtes/TechNet-Gallery).\n\nAuthor: Markus Scholtes\n\nModule version: 1.0.7 / 2024-02-03\n\nScript version: 1.6 / 2024-01-31\n\n## Installation\nInstall with\n```powershell\nInstall-Module WebServer\n```\nor download manually [here](https://www.powershellgallery.com/packages/WebServer/)\n\nNow also on Powershell Gallery as part of the **SysAdminsFriends** module, see [here](https://www.powershellgallery.com/packages/SysAdminsFriends/) or install with\n```powershell\nInstall-Module SysAdminsFriends\n```\n\nProject page on github is [here](https://github.com/MScholtes/SysAdminsFriends).\n\n## Description\nThe .Net class System.Net.HttpListener delivers a basic web service without the need to install a webserver (IIS) role. Since we can use it in C#, we can do it with powershell too (and even without pain).\n\nThere are several examples of powershell webservers in the internet, but for me it seems they all have the same origin. Thank you, original coder, whoever you are! My impulse to write a powershell webserver was a short but very impressing example on powershell.com (that unfortunately is no longer online).\n\nThe module WebServer implements a webserver with the following functions:\n* a powershell command execution web form\n* powershell script upload and execution (as a function)\n* download files from the server\n* upload files to the server\n* script execution and embedded code with psp files\n* make the webserver beep (to find servers in the datacenter)\n* show webserver logs\n* show server starttime and current time\n* stop the webserver\n* deliver static content based on the script's directory if none of the commands above is requested\n\nThe webserver responds to GET methods only except the POST upload and download functionalities (implementing this really did hurt).\n\nOther functions can be implemented very easily.\n\nIf you give it a try, see remarks below by all means.\n\n## Versions\n### 1.0.7 / 2024-02-03\n - parameters can be handed to PSP files per POST method too\n - added wasm extension to mime list\n\n### 1.0.6 / 2023-03-27\n - changed header encoding to Windows 1252 to prevent data loss in cjk encodings\n - fixed bug that cut file names with semicolons in it\n\n### 1.0.5 / 2022-07-31\n - Introduced PSP files (Powershell Server Pages) for embedded execution\n - Updated list of mime types\n\n### 1.0.4 / 2022-04-15\n- Logs response code\n- Scripts (.ps1, .bat and .cmd) in web directory are executed by web server\n\n### 1.0.3 / 2022-01-19\n- Load index file in base dir instead of default page when present\n\n### 1.0.2 / 2021-07-04\n- Updated list of mime types\n\n### 1.0.1 / 2021-02-21\n- Updated links since Technet Gallery shut down\n\n### 1.0.0 / 2020-06-04\n- Initial release\n\n## Examples:\nStart webserver with binding to http://localhost:8080/:\n\n```powershell\nStart-Webserver\n```\n\nStart webserver with binding to all IP addresses of the system and port 8080. Administrative rights are necessary:\n\n```powershell\nStart-Webserver \"http://+:8080/\"\n```\n\n![Screen Console](ScreenConsole.jpg)\n\nStart powershell webserver as scheduled task as user local system every time the computer starts:\n\n```powershell\nschtasks.exe /Create /TN \"Powershell Webserver\" /TR \"powershell -Command \\\"Start-Webserver http://+:8080/\\\"\" /SC ONSTART /RU SYSTEM /RL HIGHEST /F\n```\n\nYou can start the webserver task manually with\n```powershell\nschtasks.exe /Run /TN \"Powershell Webserver\"\n```\nDelete the webserver task with\n```powershell\nschtasks.exe /Delete /TN \"Powershell Webserver\"\n```\n(Scheduled tasks are always running with low priority, so some functions might be slow)\n\n![Screen Browser](ScreenVerySmall.jpg)\n\n## Embedded code\nYou can embed powershell code in html files with psp files (\"Powershell Server Pages\"). Psp files are html files in which the switch code \u003c% toggles to powershell code and %\u003e toggles back to html. Parameters can be handed per GET or POST.\n\n![Screen Browser](PSP.jpg)\n\n\n## Remarks\n\n### Firewall\nYou may have to configure a firewall exception to allow access to the chosen port, e.g. with:\n```powershell\nnetsh advfirewall firewall add rule name=\"Powershell Webserver\" dir=in action=allow protocol=TCP localport=8080\n```\n\nAfter stopping the webserver you should remove the rule, e.g.:\n```powershell\nnetsh advfirewall firewall delete rule name=\"Powershell Webserver\"\n```\n\n### How to enable https encryption\nYou can also let the **Powershell Webserver** deliver encrypted traffic. For a description look [here](https.md).\n\n### Security\nThere is no security!!! Once started the webserver can be accessed by everyone and everyone can do on the webserver system what you can do.\n\n### Download / Upload of large files\nThere is no optimization for large file download or uploads (no chunking or similiar techniques). The transfer of large files might work, or might not.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscholtes%2Fwebserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmscholtes%2Fwebserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscholtes%2Fwebserver/lists"}