wapt-smb1-client/setup.py

40 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
from setuphelpers import *
import re
uninstallkey = []
def install():
print("Enable SMBv1 ...")
# print('Checking status of SMBv1 ...')
# smbv1_status = run_powershell('Get-WindowsOptionalFeature -Online -FeatureName smb1protocol | out-string -stream | select-string State')
# print('Current status : %s' % (smbv1_status,))
# patterns = ["Enabled"]
# text = smbv1_status
# for pattern in patterns:
# print('Looking for "%s" in "%s" ->' % (pattern, text),)
# if re.search(pattern, text):
# print('FOUND A MATCH!')
# else:
# print('NO MATCH')
smbv1_enable = run_powershell('Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart')
print('Turn ON SMBv1 : %s' % (smbv1_enable,))
print('Done, SMBv1 is now enabled. Reboot is required.')
# SMBv1 already enable
# else:
# print('SMBv1 is already enabled. No reboot required.')
def uninstall():
print("Disable SMBv1 ...")
smbv1_disable = run_powershell('Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart')
print('Turn OFF SMBv1 : %s' % (smbv1_disable,))
print('Done, SMBv1 is now disabled. Reboot is required.')