Skip to content

Instantly share code, notes, and snippets.

@IAmStoxe
IAmStoxe / RemoveWin10DefaultApps.ps1
Created November 8, 2019 22:53 — forked from tkrotoff/RemoveWin10DefaultApps.ps1
Remove Windows 10 default apps
# See Remove default Apps from Windows 10 https://thomas.vanhoutte.be/miniblog/delete-windows-10-apps/
# See Debloat Windows 10 https://github.com/W4RH4WK/Debloat-Windows-10
# Command line to list all packages: Get-AppxPackage -AllUsers | Select Name, PackageFullName
Get-AppxPackage Microsoft.Windows.ParentalControls | Remove-AppxPackage
Get-AppxPackage Windows.ContactSupport | Remove-AppxPackage
Get-AppxPackage Microsoft.Xbox* | Remove-AppxPackage
Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage # Mail and Calendar
#Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsCamera | Remove-AppxPackage
@IAmStoxe
IAmStoxe / Get-RemoteHardDisks.ps1
Last active April 15, 2020 00:54
List Hard Disk Information on Remote Computers within a Domain
$creds = Get-Credential
$serverListPath = "C:\tmp\PhysicalHosts.txt"
Get-WmiObject win32_diskdrive -Credential $creds -Computer (Get-Content $serverListPath) |
Where-Object MediaType -eq 'Fixed hard disk media' |
Select-Object SystemName, Model, @{Name = 'Size(GB)'; Exp = { $_.Size / 1gb -as [int] } } |
Export-CSV "C:\tmp\disks.csv"
@IAmStoxe
IAmStoxe / Remove-TeamsCacheData.ps1
Last active May 5, 2020 18:10
Remove Teams Cache
# Check to see if the process is running
$teamsProcess = Get-Process -Name "Teams" -ErrorAction SilentlyContinue
if ($teamsProcess) {
$response = Read-Host -Prompt "Teams is running. Kill it? (Y/N)"
If ($response.ToLower() -eq "y") {
$teamsProcess | Stop-Process
}
else{
exit;
@IAmStoxe
IAmStoxe / New-CWSyncServer.ps1
Created April 15, 2020 16:58
New CW SmartSync Server
function New-CWSyncServer {
<#
.DESCRIPTION
Add SmartSync server to CaseWare Working Papers.
.PARAMETER HostName
Host name of SmartSync server.
.PARAMETER Label
Friendly name of SmartSync server as it will appear in CaseWare Working Papers.
.EXAMPLE
New-CWSyncServer site01.company.com
@IAmStoxe
IAmStoxe / Remove-TeamsCacheData.ps1
Last active July 30, 2020 12:24
Remove Microsoft Teams cache data automatically.
Remove-Item (Join-Path $env:APPDATA "\Microsoft\Teams\Blob_storage\") -Recurse -Force
Remove-Item (Join-Path $env:APPDATA "\Microsoft\Teams\cache\") -Recurse -Force
Remove-Item (Join-Path $env:APPDATA "\Microsoft\Teams\IndexedDB\") -Recurse -Force
Remove-Item (Join-Path $env:APPDATA "\Microsoft\Teams\databases\") -Recurse -Force
Remove-Item (Join-Path $env:APPDATA "\Microsoft\Teams\GPUCache\") -Recurse -Force
Remove-Item (Join-Path $env:APPDATA "\Microsoft\Teams\Local Storage\") -Recurse -Force
Remove-Item (Join-Path $env:APPDATA "\Microsoft\Teams\tmp\") -Recurse -Force
@IAmStoxe
IAmStoxe / Sync-W32tmOnDomainControllers.ps1
Created May 5, 2020 20:50
Execute a time sync on all domain controllers.
$creds = Get-Credential
$DCs = Get-ADDomainController -Filter *
foreach ($DC in $DCs) {
Invoke-Command -Credential $creds -ComputerName $DC.HostName -ScriptBlock {
& W32TM /resync /rediscover
}
}
@IAmStoxe
IAmStoxe / Convert-ACLToCSV.ps1
Last active May 5, 2020 20:59
Convert an ACL to a CSV. Useful for catalogging ACLs in a CSV.
$FolderPath = "ENTER PATH"
$ExportPath = "ENTER EXPORT PATH"
$FolderItems = Get-Item -Path $FolderPath -Force
$Report = @()
Foreach ($Folder in $FolderItems) {
$Acl = Get-Acl -Path $Folder.FullName
foreach ($Access in $acl.Access) {
$Properties =
@IAmStoxe
IAmStoxe / Send-OutlookEmail.ps1
Created May 5, 2020 20:56
Send an email via Outlook
Function Send-OutlookEmail {
#REQUIRES -version 2.0
<#
.SYNOPSIS
Sends email using Microsoft Outlook.
For examples type:
Get-Help Send-OutlookEmail -examples
.DESCRIPTION
This Function uses the Outlook.Application COM object to build and
@IAmStoxe
IAmStoxe / Stop-ServiceProcessByServiceName.ps1
Created May 5, 2020 20:58
Stop a given service name's process.
$serviceName = "NAME OF THE SERVICE"
$p = Tasklist /svc /fi "SERVICES eq $serviceName" /fo csv | ConvertFrom-Csv
Stop-Process -Id $p.PID -Force
@IAmStoxe
IAmStoxe / Search-GPOReports.ps1
Created May 5, 2020 20:59
Search GPO reports by string to find a GPO that is utilizing a specific setting.
# Get the string we want to search for
$string = Read-Host -Prompt "What string do you want to search for?"
Import-Module grouppolicy
# Set the domain to search for GPOs
$DomainName = $env:USERDNSDOMAIN
# Find all GPOs in the current domain
Write-Host "Finding all the GPOs in $DomainName"