| Command | Shortcut Icon Type |
|---|---|
| Shutdown.exe /r /t 00 | Restart |
| rundll32.exe powrprof.dll,SetSuspendState 0,1,0 | Sleep |
| rundll32.exe PowrProf.dll,SetSuspendState | Hibernate |
| Rundll32.exe User32.dll,LockWorkStation | Lock PC |
This file contains hidden or 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
| function Resize-Image | |
| { | |
| <# | |
| .SYNOPSIS | |
| Resize-Image resizes an image file | |
| .DESCRIPTION | |
| This function uses the native .NET API to resize an image file, and optionally save it to a file or display it on the screen. You can specify a scale or a new resolution for the new image. | |
| It supports the following image formats: BMP, GIF, JPEG, PNG, TIFF |
This file contains hidden or 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
| <# | |
| .SYNOPSIS | |
| Removes ghost devices from your system | |
| .DESCRIPTION | |
| This script will remove ghost devices from your system. These are devices that are present but have an "InstallState" as false. These devices are typically shown as 'faded' | |
| in Device Manager, when you select "Show hidden and devices" from the view menu. This script has been tested on Windows 2008 R2 SP2 with PowerShell 3.0, 5.1, Server 2012R2 | |
| with Powershell 4.0 and Windows 10 Pro with Powershell 5.1. There is no warranty with this script. Please use cautiously as removing devices is a destructive process without | |
| an undo. | |
| .PARAMETER filterByFriendlyName | |
| This parameter will exclude devices that match the partial name provided. This paramater needs to be specified in an array format for all the friendly names you want to be excluded. |
This file contains hidden or 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
| Invoke-Command -ComputerName $WBComputers.Name -ScriptBlock { | |
| $GoneUsers = Get-WmiObject -Class win32_userprofile | | |
| Select-Object -Property *, @{ | |
| NAME = 'user' | |
| EXPRESSION = { | |
| ((New-Object -TypeName System.Security.Principal.SecurityIdentifier -ArgumentList ($_.SID)).Translate([System.Security.Principal.NTAccount])).Value | |
| } | |
| } | | |
| Where-Object -FilterScript { | |
| $_.User -eq $null |
This file contains hidden or 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
| Function Convert-Image | |
| { | |
| <# | |
| .NOTES | |
| Author: Randy Turner | |
| Version: 1.0 - 06/16/2019 | |
| .SYNOPSIS | |
| Resize and optionally convert an image file. |
This file contains hidden or 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
| #Source: https://www.reddit.com/r/PowerShell/comments/f91iv8/powershell_rdp_shortcut/fiovdac?utm_source=share&utm_medium=web2x | |
| $wshshell = New-Object -ComObject WScript.Shell | |
| $lnk = $wshshell.CreateShortcut("C:\Users\Public\Desktop\RDP.lnk") | |
| $lnk.TargetPath = "%windir%\system32\mstsc.exe" | |
| $lnk.Arguments = "/v:$IPofTarget" | |
| $lnk.Description = "RDP" | |
| $lnk.Save() |
C:\Users\patri\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json C:\Users\patri\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState\
This file contains hidden or 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
| #Source: https://www.saggiehaim.net/powershell/install-powershell-7-on-wsl-and-ubuntu/ | |
| Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux | |
| Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu -OutFile Ubuntu.appx -UseBasicParsing | |
| Add-AppxPackage .\Ubuntu.appx | |
| # Create Folder | |
| sudo mkdir /usr/share/PowerShell | |
| # Change Working Dir | |
| cd /usr/share/PowerShell | |
| sudo tar xzvf powershell-7.0.0-rc.2-linux-x64.tar.gz | |
| sudo wget https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-rc.2/powershell-7.0.0-rc.2-linux-x64.tar.gz |
This file contains hidden or 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
| $oldDom = '@newdomain.com' | |
| $newDom = '@olddomain.com' | |
| # USING GET-ADUSER AS INPUT: | |
| # Get all AD users with an email address that ends in the old domain. These will be the ones to change. | |
| $adFilter = 'mail -like "*{0}"' -f $oldDom | |
| $users = @(Get-ADUser -Filter $adFilter -Properties mail, proxyAddresses) | |
| # Loop and process each found user | |
| foreach ($user in $users) |
This file contains hidden or 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
| ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.memberof -replace '^CN=([^,]+).+$','$1' |