Here are some PowerShell notes.


Execute unsigned script

PowerShell.exe -ExecutionPolicy Bypass -File Script.ps1

Delete a character from files

Example here where we remove o character for all mp4 files

Get-ChildItem -filter *mp4 | Rename-Item -NewName {$_.Name -replace "o"}

Change network connection profile

Set-NetConnectionProfile -InterfaceIndex 10 -NetworkCategory Private

Set time

Set-Date -date "12/7/2017 4:00 PM"

Change Last Write Time

$a = Get-Item '.\Download\myfile.txt'
$a.LastWriteTime = "10/03/2016 8:00 AM"

A function to send email

Function Mail
        param ([string]$sujet)

        $encoding = [System.Text.Encoding]::UTF8
        Send-MailMessage -To -Subject $sujet -From -smtpserver -Body $sujet -Encoding $encoding

Mail "Subject"
Licence Creative Commons
This website is licensed to the public under a licence Creative Commons Attribution licence.
Contact :