Shaare your links...
6234 links
Shared links on http://www.la-pub-dans-les-films.fr/shaarli/ Home Login RSS Feed ATOM Feed Tag cloud Picture wall Daily
Links per page: 20 50 100
◄Older
page 1 / 2
28 results for tags powershell x
  • powershell commande ping avec horodatage
    ```
    #ping avec horodatage
    ping -t <adresse_ip_ou_nom> | ForEach-Object { "$(Get-Date -Format HH:mm:ss) $_" }

    ```
    Mon Feb 2 16:02:21 2026 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?CO_szQ
    heure ping powershell
  • Note: powershell afficher les reseaux wifi connus
    netsh wlan show all
    Wed Sep 17 11:21:20 2025 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?OLGw1Q
    powershell wi-fi
  • Note: powershell deplacer les dossiers contenant un type de fichier specifique (ici PDF)
    Get-ChildItem -Directory -Recurse | Where-Object {
       Get-ChildItem -Path $_.FullName -Filter *.pdf -File -Recurse -ErrorAction SilentlyContinue
    } | ForEach-Object {
       Move-Item -Path $_.FullName -Destination "C:\TOTO"
    }
    Sun Aug 31 10:58:49 2025 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?35Fo9Q
    powershell windows
  • Note: powershell supprimer tous les dossiers vides d'un repertoire
    Get-ChildItem "C:\chemin" -Directory -Recurse | Where-Object {
       ($_.GetFiles().Count -eq 0) -and ($_.GetDirectories().Count -eq 0)
    } | Remove-Item
    Sun Aug 31 10:55:55 2025 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?xLECGg
    powershell windows
  • Note: connaître le type de RAM installé sur un PC Windows avec PowerShell
    Get-CimInstance -ClassName Win32_PhysicalMemory | Format-Table capacity, speed, manufacturer, partnumber, formfactor, smbiosmemorytype


    Cette commande affiche :

    La capacité de chaque barrette de RAM (en octets)

    La fréquence (MHz)

    Le fabricant

    Le code produit

    Le format (FormFactor : 8=DIMM, 12=SODIMM)

    Le type (SMBIOSMemoryType : 20=DDR, 21=DDR2, 24=DDR3, 26=DDR4, 34=DDR5)
    Fri Aug 29 12:59:32 2025 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?ATCiXA
    powershell ram windows
  • Lance cette commande pour remplacer "bimbamboum" par "toto" dans tous les fichiers texte du dossier
    Get-ChildItem -Filter *.txt | ForEach-Object {
       (Get-Content $_.FullName) -replace 'bimbamboum', 'toto' | Set-Content $_.FullName
    }
    Sat Aug 16 13:51:12 2025 - permalink -
    - ?WZhw-w
    powershell
  • powershell Extraire le préfixe du nom de fichier (tout ce qui se trouve avant blurpblurp) creer des dossiers et y ranger les fichiers correspondants
    # Chemin du dossier contenant les fichiers
    $sourceFolder = "C:\temp"

    # Obtenir tous les fichiers dans le dossier source
    $files = Get-ChildItem -Path $sourceFolder

    foreach ($file in $files) {
       # Extraire le préfixe du nom de fichier (tout ce qui se trouve avant "S01")
       $prefix = $file.Name -replace "(S01.*)", ""

       # Créer le dossier de destination si nécessaire
       $destinationFolder = Join-Path -Path $sourceFolder -ChildPath $prefix
       if (-not (Test-Path -Path $destinationFolder)) {
           New-Item -ItemType Directory -Path $destinationFolder
       }

       # Déplacer le fichier vers le dossier de destination
       Move-Item -Path $file.FullName -Destination $destinationFolder
    }
    Thu Jan 9 17:12:24 2025 - permalink -
    - ?LRlM-g
    powershell
  • How to uninstall Cortana
    Get-AppxPackage Microsoft.549981C3F5F10 | Remove-AppxPackage
    Fri Dec 27 16:01:11 2024 - permalink -
    - https://www.tomsguide.com/news/how-to-uninstall-cortana
    cortana powershell
  • Note: vider corbeille (powershell)
    Clear-RecycleBin -Force
    Wed Sep 11 13:38:38 2024 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?QzQ4ug
    powershell windows
  • Note: script powershell pour deplacer un dossier à une heure precise
    ~~~ps
    # Définir les paramètres
    $sourcePath = "C:\Chemin\Vers\DossierSource"
    $destinationPath = "C:\Chemin\Vers\DossierDestination"
    $scheduledTime = "15:30" # Heure planifiée au format HH:mm

    # Fonction pour déplacer le dossier
    function Move-Folder {
       if (Test-Path $sourcePath) {
           Move-Item -Path $sourcePath -Destination $destinationPath -Force
           Write-Host "Dossier déplacé avec succès de $sourcePath vers $destinationPath"
       } else {
           Write-Host "Le dossier source $sourcePath n'existe pas"
       }
    }

    # Boucle principale
    while ($true) {
       $currentTime = Get-Date -Format "HH:mm"
       
       if ($currentTime -eq $scheduledTime) {
           Move-Folder
           break
       }
       
       Start-Sleep -Seconds 60 # Attendre 1 minute avant de vérifier à nouveau
    }
    ~~~
    Tue Sep 10 20:32:58 2024 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?BtVU_w
    powershell
  • Note: To execute a script when a specific event, such as the occurrence of the word "baba," appears in a log file
    To execute a script when a specific event, such as the occurrence of the word "baba," appears in a log file, you can use a combination of PowerShell and a file system watcher. This method will continuously monitor the log file for changes and trigger the script when the specified event occurs.

    Here's how you can set this up using PowerShell:

    ### Step 1: Create the PowerShell Script

    1. **Create a PowerShell Script**: Open a text editor and paste the following PowerShell script. Save it with a `.ps1` extension, e.g., `MonitorLog.ps1`.

      ```powershell
      # Define the path to the log file and the script to execute
      $logFilePath = "C:\path\to\your\logfile.log"
      $scriptToExecute = "C:\path\to\your\script.bat"  # or .ps1 for PowerShell script

      # Create a file system watcher to monitor the log file
      $fileWatcher = New-Object System.IO.FileSystemWatcher
      $fileWatcher.Path = Split-Path $logFilePath
      $fileWatcher.Filter = (Split-Path $logFilePath -Leaf)
      $fileWatcher.NotifyFilter = [System.IO.NotifyFilters]'LastWrite'

      # Define the action to take when the log file changes
      $action = {
          # Read the log file and check for the event
          $content = Get-Content -Path $logFilePath -Tail 10
          if ($content -match "baba") {
              # Execute the script
              Start-Process -FilePath $scriptToExecute
          }
      }

      # Register the event handler
      Register-ObjectEvent -InputObject $fileWatcher -EventName Changed -Action $action

      # Start monitoring
      $fileWatcher.EnableRaisingEvents = $true

      # Keep the script running
      while ($true) {
          Start-Sleep -Seconds 1
      }
      ```

    ### Step 2: Run the PowerShell Script

    1. **Open PowerShell as Administrator**: You may need administrative privileges to execute scripts, especially if they affect system settings or files.

    2. **Set Execution Policy**: If your system's execution policy prevents scripts from running, you can change it temporarily by running:
      ```powershell
      Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
      ```

    3. **Execute the Script**: Run the PowerShell script you created:
      ```powershell
      .\MonitorLog.ps1
      ```

    ### Explanation

    - **File System Watcher**: This PowerShell feature monitors changes to the specified log file.
    - **Action**: When the file changes, the script reads the last few lines and checks for the presence of the word "baba."
    - **Script Execution**: If "baba" is found, the specified script is executed.

    ### Notes

    - **Script Path**: Make sure to replace the paths in the script with the actual paths to your log file and the script you want to execute.
    - **Log File Path**: Ensure the log file path is correct and accessible.
    - **Continuous Monitoring**: The script runs continuously, monitoring the log file for changes.

    This setup provides a simple and effective way to automate responses to specific events in a log file.
    Tue Sep 3 23:51:19 2024 - permalink -
    - http://www.la-pub-dans-les-films.fr/shaarli/?4h_CuQ
    powershell
  • Own note powershell renommer fichier et y inserer du contenu depuis un fichier texte
    movies

    # Lire le contenu du fichier "input.txt"
    $fichiers = Get-Content -Path "C:\blabla\input.txt"

    # Créer les fichiers texte
    #foreach ($fichier in $fichiers) {
    #    $nomFichier = [System.IO.Path]::GetFileName($fichier)
    #    $fichierComplet = Join-Path -Path "C:\blabla" -ChildPath $nomFichier
    #    New-Item -Path $fichierComplet -ItemType File -Value $fichier
    #    Write-Output "Fichier $nomFichier créé."
    #}

    # Créer les fichiers texte avec une certaine extension
    foreach ($fichier in $fichiers) {
       $nomFichier = [System.IO.Path]::GetFileNameWithoutExtension($fichier) + ".strm"
       $fichierComplet = Join-Path -Path "C:\blabla" -ChildPath $nomFichier
       New-Item -Path $fichierComplet -ItemType File -Value $fichier
       Write-Output "Fichier $nomFichier créé."
    }

    ---------------------------

    TV show

    $input_file = "input.txt"

    Get-Content $input_file | ForEach-Object -Begin {
       $line_num = 1
    } -Process {
       $line = $_.TrimEnd()
       $line = $line -replace '\s+$'
       $output_file = "output_$line_num.strm"
       Set-Content $output_file $line
       $line_num++
    }
    Mon Aug 26 14:27:39 2024 - permalink -
    - ?QfNNhg
    powershell
  • Win11Debloat
    A check
    Sat Jul 20 09:35:26 2024 - permalink -
    - https://github.com/Raphire/Win11Debloat
    debloat powershell Windows
  • Powershell : 4 scripts amusants pour apprendre à s'en servir
    Sun Jul 14 10:59:21 2024 - permalink -
    - https://www.phonandroid.com/powershell-4-scripts-amusants-pour-apprendre-a-sen-servir.html
    Powershell
  • How to Send email with PowerShell - ALI TAJRAN
    Wed Jun 12 13:09:57 2024 - permalink -
    - https://www.alitajran.com/send-email-powershell/
    email Powershell
  • GitHub - PowerAruba/PowerArubaCX: PowerShell module to manage ArubaCX switches
    Tue Jun 11 21:54:31 2024 - permalink -
    - https://github.com/PowerAruba/PowerArubaCX
    aruba Powershell
  • Microsoft 365 : ajoutez des utilisateurs avec PowerShell | LeMagIT
    Tue Jun 11 20:23:49 2024 - permalink -
    - https://www.lemagit.fr/conseil/Microsoft-365-ajoutez-des-utilisateurs-avec-PowerShell
    microsoft powershell
  • [Windows] Fermer toutes les sessions RDP mal fermées
    Voici comment fermer les sessions déconnecter en une ligne de commande PowerShell.

    La ligne de commande avec « quser »

    C’est grâce à quser que nous pouvons identifier les sessions déconnectées qui ne sont pas fermées :

    quser | Where-Object { $_ -notmatch (Get-Date).ToString("dd/MM/yyyy") } | Select-String "Déco" | ForEach {logoff ($_.tostring() -split ' +')[2]}

    Que fait cette commande ?
    Cette commande ferme toutes les sessions déconnectées qui ne datent pas d’aujourd’hui. En effet je considère qu’une session déconnectées depuis plus d’un jour n’a rien à faire sur une serveur.

    ⚠️ Cela peut engendrer une perte de données si vos utilisateurs ont un logiciel ouvert (comme Word) parce que la session sera fermée en mode forcé (les modifications non enregistrées seront perdues).
    Wed Apr 17 20:11:42 2024 - permalink -
    - https://blogmotion.fr/programmation/powershell/windows-fermer-toutes-les-sessions-rdp-mal-deconnectees-21188
    powershell windows
  • powershell outrepasser nombre de caractere
    Voici une réponse concise et précise à votre question :

    Le problème que vous rencontrez est lié à la limitation du nombre de caractères dans les chemins d'accès des fichiers sur Windows. Cette limitation est de 260 caractères pour le chemin d'accès complet et de 248 caractères pour le nom du répertoire.[1][5]

    Pour outrepasser cette limitation, vous pouvez utiliser le préfixe "\\?\" devant le chemin d'accès. Cela permet d'étendre la limite à 32 767 caractères.[5] Voici comment modifier votre script :

    ```powershell
    $date = Get-Date -UFormat "%d-%m-%y"
    $old = (Get-Date).AddDays(-7)

    Get-Date >> "\\?\c:\search\avi-mp3-$date.txt"
    Get-ChildItem "\\?\d:\" -Recurse -Include *.mp3,*.avi >> "\\?\c:\search\avi-mp3-$date.txt"
    Get-Date >> "\\?\c:\search\avi-mp3-$date.txt"
    Get-ChildItem "\\?\c:\search" -Include *.* -Recurse | Where {$_.LastWriteTime -le $old} | Remove-Item -Force
    ```

    Cela devrait vous permettre de contourner l'erreur liée à la limitation du nombre de caractères dans les chemins d'accès.[1][5]

    [1] https://www.powershell-scripting.com/index.php/forum/5-entraide-pour-les-debutants/4972-limitation-nombre-de-caract%C3%A8res-dans-le-path[5] https://learn.microsoft.com/fr-fr/powershell/module/microsoft.powershell.utility/measure-object?view=powershell-7.4

    Citations:
    [1] https://learn.microsoft.com/fr-fr/powershell/module/microsoft.powershell.utility/select-string?view=powershell-7.4
    [2] https://www.editions-eni.fr/livre/debuter-avec-powershell-9782409039645/manipuler-les-chaines-de-caracteres
    [3] https://www.it-connect.fr/powershell-grep-rechercher-des-chaines-de-caracteres-avec-select-string/
    [4] https://learn.microsoft.com/fr-fr/powershell/module/microsoft.powershell.utility/measure-object?view=powershell-7.4
    [5] https://www.powershell-scripting.com/index.php/forum/5-entraide-pour-les-debutants/4972-limitation-nombre-de-caract%C3%A8res-dans-le-path
    Mon Apr 15 08:48:52 2024 - permalink -
    - https://www.perplexity.ai/search/powershell-outrepasser-nombre-BbQ88RTPRe.9Q.PPD7B40w
    powershell
  • Powershell Outrepasser limite du nombre de caractères
    A check

    Voici la réponse à votre question :

    La limite par défaut du nombre de caractères dans un chemin d'accès Windows est de 260 caractères (MAX_PATH). Cependant, il est possible de supprimer ou d'augmenter cette limite avec PowerShell[1][2] :

    ## Supprimer la limite de 260 caractères
    Pour supprimer complètement la limite de 260 caractères, vous pouvez suivre ces étapes :

    1. Ouvrir l'Éditeur du Registre Windows (regedit.exe)
    2. Accéder à la clé de registre : `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem`
    3. Modifier la valeur `LongPathsEnabled` et la définir sur `1` pour l'activer

    Une fois cette modification effectuée, Windows pourra gérer des chemins d'accès de jusqu'à 32 767 caractères.

    ## Augmenter la limite à 32 767 caractères
    Vous pouvez également augmenter la limite à 32 767 caractères sans la supprimer complètement. Pour cela :

    1. Ouvrir une fenêtre PowerShell en tant qu'administrateur
    2. Exécuter la commande suivante :
    ```powershell
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
    ```

    Cette commande modifie directement la clé de registre `LongPathsEnabled` pour activer la prise en charge des longs chemins d'accès.

    Notez que même après avoir augmenté cette limite, certaines applications comme l'Explorateur Windows ou l'Invite de commandes peuvent encore avoir des limitations. Seules les applications qui utilisent l'API Windows appropriée pourront bénéficier de cette augmentation de limite[2].

    Citations:
    [1] https://www.autodesk.fr/support/technical/article/caas/sfdcarticles/sfdcarticles/FRA/The-Windows-10-default-path-length-limitation-MAX-PATH-is-256-characters.html
    [2] https://www.lecoindunet.com/modifier-la-limite-de-caracteres-des-chemins-dacces-windows
    [3] http://msreport.free.fr/articles/TESTER_SECURITE_ACTIVE_DIRECTORY_V_2.0.pdf
    [4] https://blog.metsys.fr/mise-en-oeuvre-dune-pki-du-chiffrement-efs-et-de-bitlocker/
    [5] https://www.editions-eni.fr/livre/securite-informatique-ethical-hacking-apprendre-l-attaque-pour-mieux-se-defendre-6e-edition-9782409033667/malwares-etude-des-codes-malveillants
    Fri Apr 12 21:55:30 2024 - permalink -
    - https://www.perplexity.ai/search
    powershell
Links per page: 20 50 100
◄Older
page 1 / 2
Shaarli 0.0.41 beta - The personal, minimalist, super-fast, no-database delicious clone. By sebsauvage.net. Theme by idleman.fr.