Skip to content

Instantly share code, notes, and snippets.

View jasongaylord's full-sized avatar
⏲️
Trying to find time to code.

Jason N. Gaylord jasongaylord

⏲️
Trying to find time to code.
View GitHub Profile
@jasongaylord
jasongaylord / Get-ADComputerCDRomInfo.ps1
Created May 29, 2013 17:56
We have CD-Roms that float around and for some reason, we can never find it. This PowerShell script will connect to Active Directory, pull all of the computers, and check each for a CD-Rom. It will populate the machine name, drive letter, disk name (if available), and any errors that result. Keep in mind that a Windows XP machine reports the CD-…
Function Get-ADComputerCDRomInfo
{
# Search Active Directory for computers
([adsisearcher]"objectcategory=computer").findall() | ForEach-Object {
# Set computer name
$c = ([adsi]$_.path).Name;
# Function variables
$deviceId = ""
$volumeName = ""
@jasongaylord
jasongaylord / GetBusinessDay.sql
Last active December 14, 2015 13:48
I had a request to show the calendar for the last 7 business days a part time employee worked. However, to ensure that I have the correct start date to show a 2 week calendar, I needed to omit any day the person was off. It's a strange request, but this is interesting.
-- Assume that we have a table that tracks the days off. We'll define it here
-- when actually we'd be pulling this from our connection.
declare @myDaysOff table
(
dayOff datetime
)
-- Let's seed this table
insert into @myDaysOff (dayOff)
values ('2/20/2013'), ('2/27/2013'), ('3/2/2013'), ('3/3/2013')
@jasongaylord
jasongaylord / delete_tables_byprefix.sql
Created November 16, 2012 22:49
TSQL - Delete Tables with a Prefix
declare @cmd varchar(4000)
declare cmds cursor for
Select 'drop table [' + Table_Name + ']'
From INFORMATION_SCHEMA.TABLES
Where Table_Name like 'prefix%'
open cmds
while 1=1
begin
@jasongaylord
jasongaylord / MainForm.Designer.cs
Created June 19, 2012 03:33 — forked from anonymous/MainForm.Designer.cs
TaskFactoryWithUIUpdates
namespace TestTaskFactory
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>