Init a functional script

This commit is contained in:
Heuze Florent 2020-12-31 16:28:47 +01:00
parent 2b86e88873
commit 3cd8b78aba
2 changed files with 71 additions and 68 deletions

View File

@ -18,7 +18,7 @@ min_wapt_version :
sources :
installed_size :
impacted_process :
description_fr : SMB1 Client on Windows
description_fr : SMBv1 Client on Windows
description_pl :
description_de :
description_es :

View File

@ -1,37 +1,40 @@
# -*- coding: utf-8 -*-
from setuphelpers import *
import re
uninstallkey = []
def install():
print("Enable SMB v1")
print('Checking status')
print("Enable SMBv1 ...")
if:
# 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,))
else:
# 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 SMB v1')
print('Checking status')
if:
print("Disable SMBv1 ...")
else:
smbv1_disable = run_powershell('Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart')
# Disable :
#
# Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart
#
# Enable :
#
# Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart
#
# Status :
#
# Get-WindowsOptionalFeature -Online -FeatureName smb1protocol
#
# https://docs.microsoft.com/fr-fr/windows-server/storage/file-server/troubleshoot/detect-enable-and-disable-smbv1-v2-v3
print('Turn OFF SMBv1 : %s' % (smbv1_disable,))
print('Done, SMBv1 is now disabled. Reboot is required.')