사용자 도구

사이트 도구


powershell

문서의 이전 판입니다!


Power Shell

# 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
# 암호입력
$secureString = Read-Host -AsSecureString 
# 문자열로 변환
$secureString | ConvertFrom-SecureString  
 
# credential.txt에 저장
Read-Host -AsSecureString | ConvertFrom-SecureString | Set-Content "credential.txt"
# creadential.txt에서 credential 복원
$secureString = Get-Content "credential.txt" | ConvertTo-SecureString
powershell.1586401016.txt.gz · 마지막으로 수정됨: (바깥 편집)