파이썬 winreg 모듈을 이용한 PC 공유폴더 레지스트리 설정 점검
- PC : AutoShareWks
- Server : AutoShareServer
DOC : https://docs.python.org/3/library/winreg.html
import winreg
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters', 0)
# winreg.OpenKey(key, sub_key, reserved=0)
cnt = 0
while True:
try:
name, data , kind = winreg.EnumValue(key,cnt) # 레지스트리 키 오픈 튜플로 반환. winreg.EnumValue(key, index)
cnt += 1
if name == 'AutoShareWks' and data == 0:
print('기본공유 설정이 Disabled 되어 있습니다. [%s], [%d]'%(name, data))
break
except OSError:
print('기본공유 설정을 찾을 수 없습니다.')
exit(0)
winreg.CloseKey(key)
----------------------------------------------------------------------------------
기본공유 설정이 Disabled 되어 있습니다. [AutoShareWks], [0]
'Python > Python for Windows' 카테고리의 다른 글
[Python] To send an attachment when mailing (0) | 2019.09.30 |
---|---|
[Python] pandas를 이용한 iis-ftp log 파싱 (0) | 2019.09.16 |
[Python] psutil을 이용한 프로세스/로컬IP/로컬Port/리모트IP/리모트Port 모니터링 (0) | 2019.09.08 |
[Python] Check ICMP using ping3 module, maria db and grafana (0) | 2019.08.25 |
[Python] check ICMP using ping3 module. (파이썬을 이용한 ping 체크) (0) | 2019.08.19 |
윈도우 2012 NTP 서버 구축 (1) - 외부 인터넷 시간 동기화 설정 (0) | 2019.08.07 |
윈도우 2012 NTP 서버 구축 (4) - NTP 서버 설정 (0) | 2019.08.07 |
윈도우 2012 NTP 서버 구축 (3) - 모니터링결과 메일 받기 (0) | 2019.08.07 |