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 |
Tags
- nvme
- resize2fs
- Query
- Windows
- VPN
- DISK
- 인스턴스타입
- mysql
- EBS
- Linux
- port
- EC2
- x-real-ip
- ubuntu
- DELETE
- Error
- deragistration
- centos
- RDS
- xen
- x-forward-for
- 센토스
- AWS
- onpromise
- terraform
- 리눅스
- ntp
- awscli
- 아마존
- fdisk
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