Skip to content

Instantly share code, notes, and snippets.

View Chirishman's full-sized avatar
⚔️
I guess statuses are a thing now

Chirishman

⚔️
I guess statuses are a thing now
View GitHub Profile
@Chirishman
Chirishman / TipsandTricks.md
Last active March 15, 2021 14:00
Tips And Tricks

Tips and Tricks

To evaluate something and also store it in a variable in the most concise way possible

if (($a = $true)){
    #TrueCondition
}
@Chirishman
Chirishman / ISPrequel1-Monitors.ps1
Last active May 16, 2018 23:03
IronScripter Prequel 1
function Get-MonitorInfo {
[CmdletBinding()]
Param(
[Parameter(ValueFromPipelineByPropertyName=$true)]
[string[]]$ComputerName = $env:COMPUTERNAME
)
$MonitorSelect = @(
@{
N = 'ComputerName'
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 = $_
{"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
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Chirishman
Chirishman / Start-ProgressSleep.ps1
Last active April 27, 2018 01:40 — forked from evoelker/Start-Progress.ps1
Powershell sleep function, with progress bar.
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
@Chirishman
Chirishman / CorrectHomeFolderPermissions.ps1
Created April 26, 2018 22:39
Script to correct home folder permissions
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)
@Chirishman
Chirishman / DellSpecLookup.ps1
Created April 18, 2018 02:59
Really Really Rough Dell Spec Lookup
#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 | %{
@Chirishman
Chirishman / OneoffCode.ps1
Created February 9, 2018 18:05
Code examples for using ADAuth module to create Active Directory UD Login Pages
$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
}
@Chirishman
Chirishman / DefineEventTable.sql
Last active February 8, 2018 19:58
Basic data collection and upsert tool
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),
@Chirishman
Chirishman / userChrome.css
Created February 8, 2018 05:30
TreeView Customization
/* 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 */