Skip to content

Instantly share code, notes, and snippets.

View alexinnes's full-sized avatar

Alex Innes alexinnes

  • Glasgow
View GitHub Profile
@alexinnes
alexinnes / SystemUptime.ps1
Created August 2, 2018 09:23
Get System Uptime
function Get-Uptime {
<#
.Synopsis
gets the computers uptime in Days, Hours and Minutes
.DESCRIPTION
gets the computers uptime in Days, Hours and Minutes
.EXAMPLE
Get-Updtime -Computername <ComputerName>
.EXAMPLE
Get-Uptime #Gets the uptime of the local computer.
@alexinnes
alexinnes / Get-LoggedOnUser.ps1
Last active June 8, 2018 14:09
Gets the user object of a user that is logged into a station.
function Get-LoggedOnUser {
<#
.Synopsis
Gets the logged in user of the station
.DESCRIPTION
Uses WMI to get the user who is logged in while stripping out the common SIDS
.EXAMPLE
Get-LoggedOnUser
.EXAMPLE
Get-LoggedOnUser -ComputerName Some-Computer
@alexinnes
alexinnes / remove-Profile.ps1
Last active January 5, 2018 16:53
Able to remove profiles for computers on the network without having to have delprof
function Remove-Profile {
[CmdletBinding()]
param (
[Parameter(Mandatory=$false, Position=1)]
#Default Param is the local computer.
$Computer = $env:COMPUTERNAME,
[Parameter(Mandatory=$True, Position=0)]
[string]$Username
)
@alexinnes
alexinnes / LongFileNames.ps1
Created June 7, 2017 08:16
Quick script to find long file names and outputs them to the out-gridview
get-childitem -path "H:\" -Recurse -Force | Where{$_.Fullname.Length -gt 200} | select fullname | Out-GridView
@alexinnes
alexinnes / Get-VSSWriters.ps1
Last active August 12, 2021 07:50
Get-VSSWriters
function Get-VSSWriters {
<#
.Synopsis
Performs VSSAdmin list writers
.DESCRIPTION
Gets the VSS Writers and outputs it as a object.
.EXAMPLE
Get-VSSWriters
.NOTES
Uses regex to get the information and then splits it into objects.
@alexinnes
alexinnes / Get-PendingWindowsUpdates.ps1
Created December 2, 2016 08:15
Gets pending/failed updates on a Windows Update server
<#
.Synopsis
Function to get updates that are pending on a WSUS server.
.DESCRIPTION
Function looks at the NotInstalled, IntalledPendingReboot, Downloaded and Failed updates and returns them into a hash table.
.EXAMPLE
Get-PendingWindowsUpdates
.EXAMPLE
Get-PendingWindowsUpdates -ComputerName "Update-server"
.INPUTS
@alexinnes
alexinnes / EventLog_File.ps1
Last active October 26, 2016 08:58
Create an EventLog and a LogFile.
function Create-ScriptEventLog
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$True,
Position=1)]
[string]$Source = "",
[Parameter(Mandatory=$false,
@alexinnes
alexinnes / GUI_Outline.ps1
Created August 31, 2016 07:31
Outline for creating GUIs
#Add XAML code inbetween the two @
$inputXML = @"
"@
$inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
@alexinnes
alexinnes / systemspecs.ps1
Created August 23, 2016 08:06
System specs
#Add XAML code inbetween the two @
$inputXML = @"
<Window x:Name="Sytem_Info" x:Class="SystemSpecs.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="System Viewer v1" Height="466.667" Width="1149.561" WindowStyle="ToolWindow">
<Grid Margin="0,98,0,0">
<TabControl Margin="10,-51,10,10" Name="TabControl">
<TabItem Header="BIOS">
@alexinnes
alexinnes / restart-clip.ps1
Created August 19, 2016 09:53
Clear the clipboard
function restart-clip
{
cmd /c echo.|clip
}