Skip to content

Instantly share code, notes, and snippets.

View orrwil's full-sized avatar

William Orr orrwil

  • NICS
  • Belfast, Northern Ireland
View GitHub Profile
@orrwil
orrwil / PS-AllScriptsAndDescriptions.ps1
Last active August 19, 2024 19:37
Snippits of useful powershell
<#############################
## 2015-07-10, 14:45 -
## Check if Session running with evevated / administrator privledges
#############################>
([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
#Ref: http://www.jonathanmedd.net/2014/01/testing-for-admin-privileges-in-powershell.html
<#############################
## 2015-07-10, 11:10 -
@orrwil
orrwil / Test-Servers
Last active August 29, 2015 14:05
Refactoring of daily check scripts into a single script
############
## DAILY CHECKS
############
# 00. Initial Setup
<#
Set-Location \\WIN8\ISB\
mkdir Logs
Get-ADComputer -Filter * | select Name | Out-File \\WIN8\ISB\Lists\AllComputers.txt
@orrwil
orrwil / Get-ADGuidLen
Created August 27, 2014 20:35
GUIDs from Send-AD2SQL exceeding standard 36 char GUID length
Function Get-ADGuidLen{
begin{}
Process{
foreach ($user in (Get-ADUser -Filter *))
{
$props = @{"User"=$user.DistinguishedName;
"GuidLength"=$user.ObjectGUID.ToString().Length;}
$obj = New-Object -TypeName psobject -Property $props
Write-Output $obj
}