Skip to content

Instantly share code, notes, and snippets.

Dan Blank danblank000

Block or report user

Report or block danblank000

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danblank000
danblank000 / Find_Current_Queries.sql
Created Aug 22, 2017
See what queries are currently running
View Find_Current_Queries.sql
SELECT sqltext.TEXT
, req.session_id
, req.status
, req.command
, req.cpu_time
, req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
AS sqltext
@danblank000
danblank000 / NI_Checker.PS1
Last active Aug 22, 2017
Cmdlet with GUI to query a specific value against a Database
View NI_Checker.PS1
Add-Type -AssemblyName System.Windows.Forms
$NIChecker = New-Object system.Windows.Forms.Form
$NIChecker.Text = "Form"
$NIChecker.TopMost = $true
$NIChecker.Width = 304
$NIChecker.Height = 289
$Label = New-Object system.windows.Forms.Label
$Label.Text = "Enter the National Insurance Number below"
@danblank000
danblank000 / Staff_Photos.ps1
Created Aug 20, 2017
Adding Multiple or Individual Photos to the GAL
View Staff_Photos.ps1
<#
######
IMPORT PHOTOS EN-MASSE BASED ON THE PHOTOS BEING NAMED AFTER THE RELEVANT USERS
e.g. for staff members Alan Alanson, Barry Barryson, Charles Charleson,
the photos would need to be name "Alan Alanson.jpg", "Barry Barryson.jpg", "Charles Charleson.jpg".
#####
#>
$PhotoPath = "\\SERVER\SHARE\photos\Outlook\*.*"
ForEach ($PhotoFile in gci $PhotoPath)
@danblank000
danblank000 / What_Machine_User_Logged_In_To.ps1
Created Aug 19, 2017
Queries share connections to see what machine a users is currently logged in to
View What_Machine_User_Logged_In_To.ps1
Import-Module activedirectory
write-host "**************************************************************"
Write-Host "`nThis script will tell you what computer a user is logged in to" -ForegroundColor Yellow -BackgroundColor Black
write-host "`n**************************************************************"
$i = 0
#sets up credentials
$myusername = "**DOMAIN**\" + [Environment]::UserName
@danblank000
danblank000 / Capitalise_User_Details.ps1
Last active Aug 18, 2017
Capitalise title, department, givenname, surname and displayname for all users in Active Directory
View Capitalise_User_Details.ps1
$users = get-aduser -Filter * -SearchBase #"ou=OU,dc=MYD,dc=local"
foreach ($user in $users)
{
$person = get-aduser $user -Properties title, department, givenname, surname, displayname | select displayname, title, department, givenname, surname
$displayname = ($person.displayname).ToString()
$title = ($person.title).ToString()
$department = ($person.department).ToString()
$givenname = ($person.givenname).ToString()
@danblank000
danblank000 / Get_Computer_Info.ps1
Created Aug 18, 2017
Find useful information about a machine
View Get_Computer_Info.ps1
Function Model
{
$Description = Get-WmiObject -Class Win32_OperatingSystem -Computer $Computer -Credential $Credentials
$Model = get-wmiobject -class "Win32_Computersystem" -computer $Computer -Credential $Credentials
$Ram = ($Model.TotalPhysicalMemory/1GB)
$Ram = [Math]::Round($Ram, 2)
Write-host
Write-host "Computer :" $Model.Name.ToUpper()
You can’t perform that action at this time.