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-QUserOutput { | |
| <# | |
| .SYNOPSIS | |
| Converts the output of quser.exe into a structured format. | |
| .DESCRIPTION | |
| This function takes the output of quser.exe and converts it into a structured format (pscustomobject) | |
| for easier manipulation and analysis. | |
| .EXAMPLE | |
| Convert-QUserOutput | format-table -AutoSize | |
| IsCurrent UserName SessionName SessionID State IdleTimeText IdleTime LogonDate |
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 Test-ADGroupLock { | |
| <# | |
| .SYNOPSIS | |
| The script will test the permissions of a group in Active Directory looking for the locking permissions set by Lock-ADGroup. | |
| .DESCRIPTION | |
| The script will enumerate the ACL of a group and look for 2 permissions and report the status: | |
| 1. Everyone:Deny on the WriteMembers Extended permission | |
| 2. Everyone:Deny on the members attribute of the group | |
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 Unlock-ADGroup { | |
| <# | |
| .SYNOPSIS | |
| The script will "lock" the membership of a group in Active Directory | |
| .DESCRIPTION | |
| The script will modify the permissions of a group to remove permissions added by Lock-ADGroup. | |
| .NOTES | |
| The script does not depend on the ActiveDirectory module, and leverages the built in ADSI functionality of | |
| Windows Powershell. 2 permissions are remove from the group. | |
| 1. Everyone:Deny on the WriteMembers Extended permission |
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 Lock-ADGroup { | |
| <# | |
| .SYNOPSIS | |
| The script will "lock" the membership of a group in Active Directory | |
| .DESCRIPTION | |
| The script will modify the permissions of a group to prevent anyone from adding users to a | |
| specific group by adding Everyone:Deny permissions to the WriteMembers extended right, and the | |
| members attribute of the group. | |
| .NOTES | |
| The script does not depend on the ActiveDirectory module, and leverages the built in ADSI functionality of |
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 Update-ADGroup { | |
| <# | |
| .SYNOPSIS | |
| The script can update a locked group, adding and removing members | |
| .DESCRIPTION | |
| This script is a companion to Lock-ADGroup, Unlock-ADGroup, and Test-ADGroup. | |
| The script will back up existing permissions, add members, remove members, and then | |
| restore the original permissions. | |
| .NOTES | |
| The script does not depend on the ActiveDirectory module, and leverages the built in ADSI functionality of |
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 Test-PrinterPorts { | |
| <# | |
| .SYNOPSIS | |
| Tests the connectivity of TCP ports on specified printers. | |
| .DESCRIPTION | |
| This function tests the connectivity of TCP ports on specified printers, either by name or IP address. | |
| The printers can be Windows printers, or OMPlus printers. The function uses a runspace pool to perform | |
| the tests concurrently, with a configurable throttle limit. | |
| .PARAMETER WindowsPrinterName | |
| The names of the Windows printers to test. |
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
| #Requires -RunAsAdministrator | |
| function Test-WillowEPSStatus { | |
| <# | |
| .SYNOPSIS | |
| Sends an email showing the status of the Willow EPS servers based on the | |
| WamEPSRecovery script | |
| .DESCRIPTION | |
| The script reads the WamEpsRecoveryConfig.xml file to determine the list of EPS servers, | |
| retrieves the failover status and print-related service statuses from each server, and compiles |
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 Get-ShortPathName{ | |
| Param([string] $path) | |
| $MethodDefinition = @' | |
| [DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "GetShortPathNameW", SetLastError = true)] | |
| public static extern int GetShortPathName(string pathName, System.Text.StringBuilder shortName, int cbShortName); | |
| '@ | |
| $Kernel32 = Add-Type -MemberDefinition $MethodDefinition -Name 'Kernel32' -Namespace 'Win32' -PassThru | |
| $shortPath = New-Object System.Text.StringBuilder(500) |
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 ConvertFrom-DHCPToStatic { | |
| <# | |
| .SYNOPSIS | |
| This script takes an existing DHCP configuration and converts it to a static IP configuration | |
| .DESCRIPTION | |
| The script uses several functions to retrieve the necessary data from the existing configuration, | |
| removes that configuration, and installs the new configuration. | |
| .NOTES | |
| This script was built with the idea that there will only be one "physical" NIC in the server that is up and | |
| running when the script is run. It has not been tested in other scenarios |
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 Backup-ArbitraryWinSCPKey { | |
| <# | |
| .SYNOPSIS | |
| This script backups a user's registry keys for WinSCP | |
| .DESCRIPTION | |
| Unlike the Backup-WinSCPKey, this script allows the user to backup an arbitrary user's | |
| WinSCP key out of HKEY_USERS\<usersid>\Software\Martin Prikryl | |
| .NOTES | |
| This does require administrator rights, since the user will be delving into HKEY_USERS. | |
| .PARAMETER SamAccountName |
NewerOlder