문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
windows:powershell [2022/01/02 19:03] kwon37xi |
windows:powershell [2024/12/13 11:26] (현재) kwon37xi [Powershell script from remote / 원격 스크립트 실행] |
||
|---|---|---|---|
| 줄 9: | 줄 9: | ||
| ===== 기본 개인 profile 파일 ===== | ===== 기본 개인 profile 파일 ===== | ||
| * [[https:// | * [[https:// | ||
| + | * Linux 의 '' | ||
| * '' | * '' | ||
| New-Item $profile -force -itemtype file | New-Item $profile -force -itemtype file | ||
| </ | </ | ||
| - | * '' | + | * '' |
| ===== Powershell Core ===== | ===== Powershell Core ===== | ||
| * [[https:// | * [[https:// | ||
| 줄 99: | 줄 100: | ||
| </ | </ | ||
| - | ===== Powershell script from remote ===== | + | ===== Powershell script from remote |
| * [[https:// | * [[https:// | ||
| <code sh> | <code sh> | ||
| - | Invoke-WebRequest -Uri https://raw.githubusercontent.com/thomasmaurer/demo-cloudshell/master/helloworld.ps1 -OutFile | + | # 한방에 실행 |
| + | Invoke-Expression (Invoke-WebRequest -Uri "https://example.com/script.ps1" | ||
| + | |||
| + | # Invoke-Expression -> iex, Invoke-WebRequest -> iwr | ||
| + | iex (iwr -Uri " | ||
| + | |||
| + | # 스크립트 다운로드 후 실행 | ||
| + | # 스크립트를 로컬에 다운로드 | ||
| + | Invoke-WebRequest -Uri " | ||
| + | |||
| + | # 다운로드한 스크립트 실행 | ||
| + | PowerShell -File " | ||
| </ | </ | ||
| - | * [[https:// | ||
| + | * 실행 정책 문제(Execution Policy) : 기본적으로 PowerShell 이 외부 스크립트 실행을 제한할 수도 있다. | ||
| + | <code sh> | ||
| + | # 실행시점에 정책 무시 | ||
| + | powershell.exe -ExecutionPolicy Bypass -Command "iex (iwr -Uri ' | ||
| + | |||
| + | # 현재 세션의 실행정책 임시 변경 | ||
| + | Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass | ||
| + | </ | ||
| ===== tail ===== | ===== tail ===== | ||
| 마지막 1000 줄 보여주면서 계속 출력하기 | 마지막 1000 줄 보여주면서 계속 출력하기 | ||
| 줄 162: | 줄 181: | ||
| Restart-Computer | Restart-Computer | ||
| </ | </ | ||
| + | |||
| + | ===== Linux PowerShell ===== | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| ===== 참조 ===== | ===== 참조 ===== | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||