Gérer un compte

Bonjour à tous, j'ai besoin d'une aide pour car je n'arrive pas à créer un script powershell qui permettra de se connecter sur un compte automatique sans qu'on puisse demander à l'utilisateur de taper son mot de passe mais tout les login seront déjà par défaut dans le script, donc on aura une variable username et pwd. Merci

Configuration: Android / Chrome 92.0.4515.166

3 réponses

  1. Modérateur
    Je ne peux que te rediriger vers cette doc de microsoft... concernant Invoke-WebRequest

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.1

    regarde surtout ce qui concerne les credentials..

    https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential?view=powershellsdk-7.0.0

    Teste d'abord sur un seul site ensuite, tu pourras gérer la liste de choix.
    1. Modérateur
      Bonjour
      à quoi seront liés ces comptes prévus ? En fonction de l'utlisateur connecté ? D'un choix au début du script ?

      1. Supposons on a 5 comptes, si l'utilisateur veut se connecter à un de ses comptes qu'on lui propose un choix et s'il fait son choix directement il sera connecter sur son compte Sans qu'on puisse demander un mot de passe.
    2. Clear-Host

      function get-menu{
      Write-Host "+----------------------------------------------------------+"-ForegroundColor Green
      Write-Host "+ NOS COMPTS D'ADMINISTRATION Copyright (C) esis 2021+"-ForegroundColor Green -BackgroundColor DarkCyan
      Write-Host "+----------------------------------------------------------+"-ForegroundColor Green
      Write-Host " "

      }
      do{
      get-menu
      Write-Host "+-------------------+" -ForegroundColor Cyan
      Write-Host "+ RESTONS CONNECTES +" -ForegroundColor Cyan
      Write-Host "+-------------------+" -ForegroundColor Cyan
      Write-Host " "
      Write-Host "===== My MENU =======" -ForegroundColor Cyan -BackgroundColor DarkRed
      Write-Host "| |" -ForegroundColor Red
      Write-Host "| 1) Facebook |" -ForegroundColor Red
      Write-Host "| 2) Instagram |" -ForegroundColor Red
      Write-Host "| 3) Gmail |" -ForegroundColor Red
      Write-Host "| 4) Whatapp |" -ForegroundColor Red
      Write-Host "| |" -ForegroundColor Red
      Write-Host "=====================" -ForegroundColor Red
      Write-Host " "

      Write-Host "1) Gerer comptes" -ForegroundColor Yellow -BackgroundColor DarkRed
      Write-Host "2) Quitter " -ForegroundColor Yellow -BackgroundColor DarkRed

      Write-Host " "
      Write-Host " veuillez faire un choix : " -ForegroundColor Black -BackgroundColor DarkRed -NoNewline
      switch ($choix =Read-Host)
      {
      "1" {Write-Host "1) facebook" -ForegroundColor Green
      Write-Host "2) instagram" -ForegroundColor Green
      Write-Host "3) gmail" -ForegroundColor Green
      Write-Host "4) whatsapp" -ForegroundColor Green
      Write-Host "5) quitter" -ForegroundColor Green
      write-host "veuillez faire un choix :" -ForegroundColor Red -NoNewline
      switch ($choi =Read-Host)
      {

      "1" {
      start ('https://login.facebook.com/login.php')

      $username = "*************"
      $PWD = "*********"
      }

      "2"{
      start www.instagram.com
      }

      "3"{
      start www.Gmail.com
      }
      "4" {exit}

      }
      pause

      }
      "2" {exit}
      default {
      Write-Warning "choix n'est pas valide"
      }
      }
      pause
      Clear-Host
      }while ($true)
      1. C'est ce que j'ai pu faire mais je ne parvient pas à me connecter automatiquement sans qu'on puisse me demander le login.