To move a folder from one location to another.
---
$source = $null
$destination = $null
$overwrite = $false
If (-Not (Test-Path -Path $destination -PathType Container))
{
New-Item -Path $destination -ItemType Container
}
Move-Item -Path $source -Destination $destination -Force:$overwrite –Verbose
To delete a folder at a given destination.
---
Delete
$folderPath = $null
if (Test-Path -Path $folderPath -PathType Container)
{
Remove-Item -Path $folderPath -Force -Recurse
}
else
{
Write-error -Message "$folderPath doesn't exist" -Category InvalidArgument
}
Compress a file or folder to a ZIP archive.
---
$source = $null
$destination = $null
$includeRootFolder = $false
$overwrite = $false
$parent = Split-Path $destination
If (-Not (Test-Path -Path $parent -PathType Container))
{
New-Item -Path $parent -ItemType Container
}
$isFile = Test-Path -Path $source -PathType Leaf
if (-Not $includeRootFolder -and -Not $isFile)
{
$source = Join-Path $source "*"
}
Compress-Archive -Path $source -DestinationPath $destination -Force:$overwrite
Extract all files and folders from a compressed ZIP archive to a selected folder.
---
$source = $null
$destination = $null
$overwrite = $false
Expand-Archive -Path $source -DestinationPath $destination -Force:$overwrite
$caption = $null
$text = $null
Add-Type -AssemblyName PresentationFramework
[System.Windows.MessageBox]::Show($text, $caption)
Upload an .msi file that will be run silently in the background.
---
Upload the .msi file for the app you want to uninstall. It will be run silently in the background.
---
Install application from the web by the application's ID and version.
Without specifying the version, winget installs the latest version of the application.
You can find the ID of the app via the 'winget search' command.
---
Run Microsoft Defender quick scan on the file system.
---