tis-powershell5

5.1-11
Windows Management Framework 5.1 including Powershell 5.1 for Windows
1466 downloads
Download
tis-powershell5 icon

  Description 

  • package : tis-powershell5
  • version : 5.1-11
  • architecture : all
  • categories : System and network
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • description : Windows Management Framework 5.1 including Powershell 5.1 for Windows
  • locale :
  • target_os : windows
  • min_wapt_version : 2.0
  • sources : https://www.microsoft.com/download/details.aspx?id=54616
  • installed_size :
  • impacted_process :
  • description_fr : Windows Management Framework 5.1 inclus Powershell 5.1 pour Windows
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : Microsoft
  • licence :
  • signature_date : 2021-10-22T12:14:09.819679
  • Homepage : https://docs.microsoft.com/powershell/
  • Depends :

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *

"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

https://docs.microsoft.com/powershell/scripting/install/installing-windows-powershell
https://docs.microsoft.com/powershell/scripting/windows-powershell/install/installing-windows-powershell?view=powershell-7.1#upgrading-existing-windows-powershell
https://www.microsoft.com/download/details.aspx?id=54616

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
kbs_dict = [
{
    "dl_url" : "https://download.microsoft.com/download/6/F/5/6F5FF66C-6775-42B0-86C4-47D41F2DA187/Win7AndW2K8R2-KB3191566-x64.zip",
    "kb_name" : "Win7AndW2K8R2-KB3191566-x64.msu",
    "win_vers": WindowsVersions.Windows7,
    "arch" : "x64"
},
{
    "dl_url" : "https://download.microsoft.com/download/6/F/5/6F5FF66C-6775-42B0-86C4-47D41F2DA187/Win7-KB3191566-x86.zip",
    "kb_name" : "Win7-KB3191566-x86.msu",
    "win_vers": WindowsVersions.Windows7,
    "arch" : "x86"
},
{
    "dl_url" : "https://download.microsoft.com/download/6/F/5/6F5FF66C-6775-42B0-86C4-47D41F2DA187/W2K12-KB3191565-x64.msu",
    "kb_name" : "W2K12-KB3191565-x64.msu",
    "win_vers": WindowsVersions.Windows81,
    "arch" : "x64"
},
{
    "dl_url" : "https://download.microsoft.com/download/6/F/5/6F5FF66C-6775-42B0-86C4-47D41F2DA187/Win8.1AndW2K12R2-KB3191564-x64.msu",
    "kb_name" : "Win8.1AndW2K12R2-KB3191564-x64.msu",
    "win_vers": WindowsVersions.WindowsServer2012,
    "arch" : "x64"
},
{
    "dl_url" : "https://download.microsoft.com/download/6/F/5/6F5FF66C-6775-42B0-86C4-47D41F2DA187/Win8.1-KB3191564-x86.msu",
    "kb_name" : "Win8.1-KB3191564-x86.msu",
    "win_vers": WindowsVersions.Windows81,
    "arch" : "x86"
},
]


def install():
    # Declaring local variables
    if iswin64():
        arch = "x64"
    else:
        arch = "x86"
    patched = False

    # Installing Windows KBs
    for kb in kbs_dict:
        kb_file = kb['kb_name']
        kb_name = kb_file.split('-')[1].upper()
        kb_nb = kb_name.replace('KB', '')
        if kb['arch'] == arch:
            if kb['win_vers'] == windows_version(members_count=2):
                with EnsureWUAUServRunning():
                    if not is_kb_installed(kb_nb):
                        print("Installing: {}".format(kb_file))
                        run(r'wusa.exe {} /quiet /norestart'.format(makepath(basedir,kb_file)), accept_returncodes=[0, 3010, 2359302, -2145124329], timeout=3600)
                        if not is_kb_installed(kb_nb):
                            error("{} installation do not complete".format(kb_name))
                    else:
                        print("{} is already installed".format(kb_name))
                    patched = True
    if not patched:
        print("INFO: No need to patch this PC")


def update_package():
    # Declaring local variables
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()

    # Downloading latest binaries
    for dl_kb in kbs_dict:
        dl_kb_file = dl_kb['dl_url'].split('/')[-1]
        if not isfile(dl_kb_file):
            wget(dl_kb['dl_url'], dl_kb_file, proxies=proxies)

    # Extracting
    for zip_in_dir in glob.glob('*.zip'):
        print("Extracting: " + zip_in_dir)
        unzip(zip_in_dir, filenames='*.msu', ignore_basename=True)
        remove_file(zip_in_dir)




def unzip(zipfn, target=None, filenames=None, ignore_basename=False, extract_with_full_paths=True):
    r"""Unzip the files from zipfile with patterns in filenames to target directory

    Args:
        zipfn (str) : path to zipfile. (can be relative to temporary unzip location of package)
        target (str) : target location. Defaults to dirname(zipfile) + basename(zipfile)
        filenames (str or list of str): list of filenames / glob patterns (path sep is normally a slash)
        ignore_basename (bool): avoid or not the generation of a parent folder when no target is given
        extract_with_full_paths (bool): keeping or not the subfolders of the archive as is

    Returns:
        list : list of extracted files

    >>> unzip(r'C:\tranquilit\wapt\tests\packages\tis-7zip_9.2.0-15_all.wapt')
    [u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\7z920-x64.msi',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\7z920.msi',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\setup.py',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/control',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/wapt.psproj',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/manifest.sha256',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/signature']

    >>> unzip(r'C:\tranquilit\wapt\tests\packages\tis-7zip_9.2.0-15_all.wapt',filenames=['*.msi','*.py'])
    [u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\7z920-x64.msi',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\7z920.msi',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\setup.py']

    >>> unzip(r'C:\tranquilit\wapt\tests\packages\tis-7zip_9.2.0-15_all.wapt',filenames='WAPT/*')
    [u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/control',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/wapt.psproj',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/manifest.sha256',
     u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT/signature']

    >>> unzip(r'C:\tranquilit\wapt\tests\packages\tis-7zip_9.2.0-15_all.wapt',filenames='WAPT/control')
    [u'C:\\tranquilit\\wapt\\tests\\packages\\tis-7zip_9.2.0-15_all\\WAPT\\control']

    >>> unzip(r'C:\tranquilit\wapt\tests\packages\tis-7zip_9.2.0-15_all.wapt',filenames='WAPT/control',ignore_basename=True)
    [u'C:\\tranquilit\\wapt\\tests\\packages\\WAPT\\control']

    >>> unzip(r'C:\tranquilit\wapt\tests\packages\tis-7zip_9.2.0-15_all.wapt',filenames='WAPT/control',extract_with_full_paths=False)
    [u'C:\\tranquilit\\wapt\\tests\\packages\\control']

    .. versionadded:: 1.3.11

    .. versionchanged:: 2.2
        added ignore_basename and extract_with_full_paths parameters 

    """
    from waptutils import CustomZipFile
    import sys
    zipf = CustomZipFile(zipfn, allowZip64=True)
    if not target:
        target = makepath(os.path.dirname(os.path.abspath(zipfn)), os.path.splitext(os.path.basename(zipfn))[0])
        if ignore_basename:
            target = makepath(os.path.dirname(os.path.abspath(zipfn)))

    if filenames is not None:
        filenames = [pattern.replace('\\', '/') for pattern in ensure_list(filenames)]

    def match(fn, filenames):
        # return True if fn matches one of the pattern in filenames
        if filenames is None:
            return True
        else:
            for pattern in filenames:
                if glob.fnmatch.fnmatch(fn, pattern):
                    return True
            return False

    if filenames is not None:
        files = [fn for fn in zipf.namelist() if match(fn, filenames)]
        members = files
    else:
        files = zipf.namelist()
        members = None

    if sys.platform != 'darwin' and extract_with_full_paths:
        zipf.extractall(target, members)
    elif not extract_with_full_paths:
        files_to_extract = files
        files = []
        os.makedirs(target, exist_ok=True)
        for fn in files_to_extract:
            filename = os.path.basename(fn)
            # skip directories
            if not filename:
                continue

            # copy file (taken from zipfile's extract)
            source = zipf.open(fn)
            files.append(os.path.join(filename))
            dest = open(os.path.join(target, filename), "wb")
            with source, dest:
                shutil.copyfileobj(source, dest)
    else: # the zipfile module doesn't support symlinks, and it's used in macOS packages
        try:
            members_str = " ".join('"{0}"'.format(m) for m in members) if members else ""
            unzip_cmd = 'unzip -qq {zipfile} {members_str} -d {destination_dir}'.format(
                                            zipfile=zipfn,
                                            members_str=members_str,
                                            destination_dir=target)
            run(unzip_cmd)
        except:
            print('Error : couldn\'t unzip {}'.format(zipfn))
            return []

    return [makepath(target, fn.replace('/', os.sep)) for fn in files]


										

  Changelog 



No changelog.txt.
									
  manifest.sha256