ExchangeOnlineManagement
Windows PowerShell ISE
Microsoft 365 - How to connect to Powershell Exchange Online
ExchangeOnlineManagement
Windows PowerShell ISE
Microsoft 365 - How to connect to Powershell Exchange Online
------ Start Script --------------------------------------------------------
#Folder Path
$FolderPath = "D:Test1"
#Check if folder exists
If (Test-Path $FolderPath) {
# Folder not exist, delete it!
Remove-Item -Path $FolderPath -Recurse
Write-host "Folder Deleted at '$FolderPath'!" -f Green
}
Else {
Write-host "Folder '$FolderPath' does not exists!" -f Red
}
------ End Script --------------------------------------------------------
PowerShell การเปิดสิทธิ์ให้ run ไฟล์สคริป เช่น delfile.ps1 ได้
- ให้เรียกใช้ powershell
- ให้พิมพ์คำสั่ง
วิธีการเปิดสิทธิ์ให้เรียกใช้ PowerShell ได้
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
วิธีการปิดสิทธิ์ไม่ให้เรียกใช้ PowerShell ได้
Set-ExecutionPolicy Restricted -Scope CurrentUser
- เรียกใช้ไฟล์สคริป เ่ช่น .\delfile.ps1