if (($a = $true)){
#TrueCondition
}
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-MonitorInfo { | |
[CmdletBinding()] | |
Param( | |
[Parameter(ValueFromPipelineByPropertyName=$true)] | |
[string[]]$ComputerName = $env:COMPUTERNAME | |
) | |
$MonitorSelect = @( | |
@{ | |
N = 'ComputerName' |
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
Write-Verbose "Display Name: $Display" | |
$TruncatedBaseDisplay = (-join([char[]]$Display | select -first 15)) | |
$FirstUnusedName = ( | |
($TruncatedBaseDisplay.Length)..1 | %{ | |
$ThisLength = $_; | |
$Digits = 15 - $ThisLength; | |
(-join([char[]]$Display | select -first $ThisLength)) | %{ | |
$ThisName = $_ |
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
{"DataTime":"2018-05-05 00:44:43Z","Class":"Bot","Method":"ProcessCompletedJobs","Severity":"Error","Log | |
Level":"Info","Message":"Errors encountered running command | |
[PoshBot.TicTacToe:New-TicTacToeGame:0.1.0]","Data":{"CommandName":null,"Message":"Cannot bind argument | |
to parameter \u0027Path\u0027 because it is | |
null.","TargetObject":null,"Position":null,"CategoryInfo":"InvalidData: (:) [Import-Module], ParameterBi | |
ndingValidationException","FullyQualifiedErrorId":"ParameterArgumentValidationErrorNullNotAllowed,Micros | |
oft.PowerShell.Commands.ImportModuleCommand"}} | |
At line:1 char:1 | |
+ Start-PoshBot -Configuration $ITBotConfig | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
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 Start-ProgressSleep { | |
Param( | |
[Parameter(ParameterSetName='seconds',Mandatory=$true)] | |
[int]$seconds, | |
[Parameter(ParameterSetName='span',ValueFromPipeline,Mandatory=$true)] | |
[timespan]$timespan | |
) | |
<# | |
.SYNOPSIS | |
Function to Start-Sleep with a progress bar |
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
Param( | |
$HomeFoldersDirectoryPath = 'C:\Default\Path\Here\' | |
) | |
$HomeFolders = Get-ChildItem $HomeFoldersDirectoryPath -Directory | |
foreach ($HomeFolder in $HomeFolders) { | |
$Path = $HomeFolder.FullName | |
$Acl = (Get-Item $Path).GetAccessControl('Access') | |
$Username = $HomeFolder.Name | |
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($Username, 'Modify', 'ContainerInherit,ObjectInherit', 'None', 'Allow') | |
$Acl.SetAccessRule($Ar) |
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
#REALLY rough, here be dragons. Still faster than doing it manually though. | |
$STList = @( | |
#Service Tags Go Here | |
'XXXXXXX', | |
'XXXXXXX' | |
) | |
$ResultTable = [System.Collections.ArrayList]::new() | |
$STList | %{ |
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
$FormLogin = New-UDAuthenticationMethod -Endpoint { | |
param([PSCredential]$Credentials) | |
Import-Module ADAuth | |
$AuthorizedGroup = 'Administrators' | |
if ($Credentials | ? {$_ | Test-ADCredential} | Test-ADGroupMembership -TargetGroup $AuthorizedGroup) { | |
New-UDAuthenticationResult -Success -UserName $Credentials.UserName | |
} |
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
DROP TABLE IF EXISTS [DATABASENAMEHERE].[dbo].[WinEvent] | |
GO | |
CREATE TABLE [DATABASENAMEHERE].[dbo].[WinEvent] ( | |
[id] int IDENTITY(1,1), | |
[TimeCreated] datetime NOT NULL, | |
[LogName] varchar(60) NOT NULL UNIQUE, | |
[ProviderName] varchar(100) NOT NULL, | |
[EventId] integer NOT NULL, | |
[LevelDisplayName] varchar(100), |
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
/* Hide main tabs toolbar */ | |
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar { | |
opacity: 0; | |
pointer-events: none; | |
} | |
#main-window:not([tabsintitlebar="true"]) #TabsToolbar { | |
visibility: collapse !important; | |
} | |
/* Sidebar min and max width removal */ |