Last active
April 14, 2021 01:22
-
-
Save tvilo/7eeca47d0e941d5abe286b98ff06dc95 to your computer and use it in GitHub Desktop.
batch files .bat
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
| @ECHO ON | |
| REM This batch script is almost identical to http://code.can.cd/winrm_setup.bat | |
| REM To use this from powershell on windows in a one liner: | |
| REM (New-Object System.Net.WebClient).DownloadFile('https://gist.github.com/juanje/8496054/raw/winrm_setup.bat','winrm_setup.bat') ; .\winrm_setup.bat | |
| cmd.exe /c winrm quickconfig -q | |
| cmd.exe /c winrm quickconfig -transport:http | |
| cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"} | |
| cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"} | |
| cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"} | |
| cmd.exe /c winrm set winrm/config/service/auth @{Basic="true"} | |
| cmd.exe /c winrm set winrm/config/client/auth @{Basic="true"} | |
| cmd.exe /c winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} | |
| cmd.exe /c netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any | |
| cmd.exe /c net stop winrm | |
| cmd.exe /c sc config winrm start= auto | |
| cmd.exe /c net start winrm | |
| @ECHO Done. |
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
| REM ============Map a network drive======================== | |
| REM net use z: \\server\share password /user:Domain\name | |
| REM ============Disconnect a network drive================= | |
| REM net use z: /delete | |
| REM ============Map a network printer====================== | |
| REM net use LPT1 \\PrintServer\LaserPrinter1 /user:Domain\name | |
| REM ============Disconnect a network printer=============== | |
| REM net use LPT1 /delete | |
| REM ============Launch a local application================= | |
| REM "C:\Path to Application\Application.exe" | |
| REM ============Open a website============================= | |
| REM start http://www.website.com | |
| REM ============Open a local file========================== | |
| REM "C:\Path to my files\myFile.doc" | |
| ECHO ON |
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
| @ECHO ON | |
| REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 | |
| @ECHO Done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment