This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#- Disable 'Allow the computer to turn off this device to save power' for all USB hubs | |
#- This is the same as going into device manager and unselecting the option | |
#- Adapted from: https://social.technet.microsoft.com/Forums/azure/en-US/49991c73-9178-496d-a73e-d2f02a836844/usb-devices-and-usb-hub-power-management-disabling-under-device-properties?forum=winserverpowershell | |
$hubs = Get-WmiObject Win32_USBHub | |
$powerMgmt = Get-WmiObject MSPower_DeviceEnable -Namespace root\wmi | |
foreach ($p in $powerMgmt) | |
{ | |
foreach ($h in $hubs) | |
{ | |
if($($p.InstanceName.ToUpper()) -like "*$($h.PNPDeviceId)*" -and $p.Enable -ne $false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([Parameter(Mandatory=$true)][string]$hostname) | |
#----------------------------------------------------------------------- | |
#- Get-SavedCredentials | |
#----------------------------------------------------------------------- | |
function Get-SavedCredentials { | |
$savedCredentials = C:\Windows\System32\cmdkey.exe /list | Select-String 'TERMSRV/' | ForEach-Object { | |
Write-Output ($_.ToString().Replace('Target: LegacyGeneric:target=','')).Trim() | |
} | |
return $savedCredentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;---------------------------------------------------; | |
;- Remote Desktop ; | |
;---------------------------------------------------; | |
^d:: | |
fqdn := TrimHostname(clipboard) | |
psCommand := "powershell C:\Users\paul\Documents\AddSavedCredential.ps1 " fqdn | |
StdoutToVar_CreateProcess(psCommand) | |
Run mstsc /admin /h:1200 /w:1600 /v:%fqdn% | |
Return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------# | |
#- Clear-WindowsUserCacheFiles # | |
#------------------------------------------------------------------# | |
Function Clear-WindowsUserCacheFiles { | |
param([string]$user=$env:USERNAME) | |
Remove-CacheFiles "C:\Users\$user\AppData\Local\Temp" | |
Remove-CacheFiles "C:\Users\$user\AppData\Local\Microsoft\Windows\WER" | |
Remove-CacheFiles "C:\Users\$user\AppData\Local\Microsoft\Windows\Temporary Internet Files" | |
} |