내용으로 건너뛰기
Out of the Box
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
Fold/unfold all
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
•
gpt_example
powershell
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== Power Shell ====== * https://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/ <code powershell> # ps remoting 기능 활성화 Enable-PSRemoting -Force Set-Item wsman:\localhost\client\trustedhosts * Restart-Service WinRM # 연결 테스트 Test-WsMan COMPUTER # 명령어 한개 실행 Invoke-Command -ComputerName COMPUTER -ScriptBlock { COMMAND } -credential USERNAME # 예) Invoke-Command -ComputerName IP -ScriptBlock { cmd /c "명령어1 && 명령어2" } -credential 유저 # 세션 연결 Enter-PSSession -ComputerName COMPUTER -Credential USER </code> * credential 생성 * https://talsu.net/?p=2108 <code powershell> # 암호입력 $secureString = Read-Host -AsSecureString # 문자열로 변환 $secureString | ConvertFrom-SecureString # credential.txt에 저장 Read-Host -AsSecureString | ConvertFrom-SecureString | Set-Content "credential.txt" # creadential.txt에서 credential 복원 Set-Variable -Name user -Value 유저 Set-Variable -Name ip -Value ???.???.???.??? $secureString = Get-Content "credential.txt" | ConvertTo-SecureString $cred = New-Object System.Management.Automation.PSCredential -ArgumentList $user, $secureString $session = New-PSSession -ComputerName $ip -Credential $cred # Invoke-Command -ComputerName $ip -ScriptBlock { cmd /c "activate base && where python && ipconfig" } -credential $cred </code>
powershell.txt
· 마지막으로 수정됨: 2024/03/23 02:38 저자
127.0.0.1
문서 도구
문서 보기
이전 판
역링크
Fold/unfold all
맨 위로