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-ValidatedCredential { | |
| <# | |
| .SYNOPSIS | |
| Retrieves a credential from the user with the standard Windows dialog, and | |
| then it validates that the password is correct for the account. | |
| .DESCRIPTION | |
| Uses the standard dialog with the option to customize the title, the prompt text, and | |
| to prefill a domain name and user name. The credential is then tested against the domain | |
| to validate that the password is correct. If it is not, the user is prompted again. |
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-EventSourceByLog { | |
| <# | |
| .SYNOPSIS | |
| This tests for multiple sources in multiple eventlogs | |
| .DESCRIPTION | |
| This works regardless of if it exists directly in registry or not. | |
| This is different than the Test-EventSource which uses a dotnet function | |
| to check for all the sources that are directly listed in the registry. | |
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-EventSource { | |
| <# | |
| .SYNOPSIS | |
| Tests for event sources against a list of computers | |
| .DESCRIPTION | |
| The function uses the [System.Diagnostics.EventLog] object to test the presence of | |
| each event source on each computer | |
| .PARAMETER EventSource |
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
| /* Reto Egeter, fullparam.wordpress.com */ | |
| DECLARE @SearchStrTableName nvarchar(255), @SearchStrColumnName nvarchar(255), @SearchStrColumnValue nvarchar(255), @SearchStrInXML bit, @FullRowResult bit, @FullRowResultRows int | |
| SET @SearchStrColumnValue = '%searchthis%' /* use LIKE syntax */ | |
| SET @FullRowResult = 1 | |
| SET @FullRowResultRows = 3 | |
| SET @SearchStrTableName = NULL /* NULL for all tables, uses LIKE syntax */ | |
| SET @SearchStrColumnName = NULL /* NULL for all columns, uses LIKE syntax */ | |
| SET @SearchStrInXML = 0 /* Searching XML data may be slow */ |
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 Show-Xaml { | |
| [cmdletbinding()] | |
| param( | |
| [parameter(Mandatory = $true, ValueFromPipeLineByPropertyName = $true, HelpMessage = 'The path to the XAML file to run')] | |
| [ValidateScript({Test-Path -path $_})] | |
| [string]$FilePath | |
| ) | |
| Add-Type -AssemblyName PresentationFramework -ErrorAction SilentlyContinue | |
| Add-Type -AssemblyName PresentationCore -ErrorAction SilentlyContinue |
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
| Import-Module PSScheduledJob | |
| function Set-DrainAndReboot { | |
| [cmdletbinding()] | |
| param( | |
| [parameter(Mandatory)] | |
| $ComputerName | |
| ) | |
| $RebootScriptBlock = @' | |
| $CitrixSessionCount = (Get-CimInstance -Namespace Root\Citrix\hdx -ClassName Citrix_Sessions ).count | |
| $CycleCount = 0 |
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 -Module Citrix.Broker.Admin.V2 | |
| function Remove-BadWinLogonSession { | |
| <# | |
| .DESCRIPTION | |
| This function searches for sessions that are in a NoApps state (Applications Not Running) and | |
| also do not have a BrokeringUserName. This state indicates a session with a hung winlogon.exe | |
| process that is not "owned" by anyone. Sessions in a NoApps state, but have a BrokeringUserName | |
| are valid inactive sessions and are not modified. |
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 Remove-BadWinLogon_CIM { | |
| <# | |
| .DESCRIPTION | |
| This function examines the list of winlogon process and compares them to active sessions. | |
| If a winlogon process belongs to an active session, it is left alone. If it is not tied | |
| to an active session, it is removed. The console session is specifically ignored, since it | |
| always has a winlogon process, even though there may not be someone logged into the physical | |
| console of the machine. | |
| .SYNOPSIS |
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 Remove-BadWinlogonProcess { | |
| [cmdletbinding(SupportsShouldProcess)] | |
| param( | |
| [parameter(Mandatory, ValueFromPipelineByPropertyName)] | |
| [string]$ServerName | |
| ) | |
| $DiscSessionWithNoName_RegEx = '^\s+(?<ID>\d+)\s+Disc' | |
| $Winlogon_RegEx = '^ system\s+\d+\s+(?<PID>\d+)\s+winlogon' |
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
| [cmdletbinding()] | |
| param( | |
| [parameter(Mandatory, ValueFromPipelineByPropertyName)] | |
| [string]$FilePath | |
| ) | |
| # .NET Framework classes | |
| Add-Type -AssemblyName PresentationFramework | |
| Add-Type -AssemblyName System.Windows.Forms | |
| # XAML |