Contactez nous

Chocolatey installation?

Share here your tips or issues concerning WAPT Console or WAPT Agent / Venez ici partager vos problèmes et astuces concernants la console et l'agent WAPT
Règles du forum

* Questions can be asked in English or in French. If the thread is started in English, stick to English, if it is started in French, stick to French.
* Vous pouvez poser vos questions en Français ou en Anglais. Si un sujet est commencé en français, merci de répondre en français. Si un sujet est commencé en anglais, merci de répondre en anglais.


How I can make a code that execute the below command?

Code : Tout sélectionner

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
A better way would be to download install.ps1 file and execute it locally instead of downloading it every time

Code : Tout sélectionner

run(r"%systemroot%\System32\WindowsPowerShell\v1.0\powershell -NoProfile -ExecutionPolicy Bypass -Command ./install.ps1")
Thanks @agauvrit!! :)

Code : Tout sélectionner

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

uninstallkey = []

def install():
    print("Instalando Chocolatey...")
        run(r"%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command c:\install.ps1; SET 'PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin'")
    except (RuntimeError, TypeError, NameError):
        print("Erro na instalação do Chocolatey")
    print("Chocolatey instalado com sucesso!")

def uninstall():
    print("Desinstalando o Chocolatey...")
    except (RuntimeError, TypeError, NameError):
        print("Erro na desinstalação do Chocolatey")
    print("Chocolatey desinstalado com sucesso!")
The uninstall function is correct? I can pass the %allusersprofile% environment variable that way?