Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- 아마존
- x-real-ip
- 리눅스
- 센토스
- port
- EC2
- mysql
- DISK
- onpromise
- RDS
- ntp
- fdisk
- DELETE
- x-forward-for
- deragistration
- VPN
- resize2fs
- nvme
- Query
- 인스턴스타입
- terraform
- EBS
- AWS
- Error
- xen
- ubuntu
- Linux
- Windows
- centos
- awscli
Archives
- Today
- Total
Cloud
windows winrm 을 사용한 date 확인 본문

#!/usr/bin/env python3
import winrm
try:
param = argv[1]
except:
param = "status"
hosts = {'$hostname':'$ip'}
user_id = '$ID'
user_pw = '$password'
def run_pwsh_cmd(pwsh_cmd):
result_byte = session.run_ps(pwsh_cmd)
result = result_byte.std_out.decode('utf-8')
return result
for hostname, ip in hosts.items():
session = winrm.Session(ip, auth=(user_id, user_pw))
date = run_pwsh_cmd('Get-Date')
print(date)'인프라관리-코드' 카테고리의 다른 글
| 온프라미스에서 테라폼 사용하기 (0) | 2024.09.25 |
|---|---|
| 여러개의 docker compose 파일 사용 시 주의사항 (0) | 2024.01.04 |
| rediscli flushdb - for문 사용 (0) | 2023.07.27 |
| windows winrm 을 사용한 log 관리 (0) | 2023.07.27 |
Comments