View Find-PST.ps1
$outputfilepath = "C:\Located-PST.csv"
$searchpath = "SEARTH_PATH"
Get-ChildItem -Force $searchpath -include *.pst -Recurse | Where-Object { ($_.PSIsContainer -eq $false) } | Select-Object Name,Directory,Length | Export-Csv $outputfilepath -NoTypeInformation
View Kaizen.ps1
# Source: http://jdhitsolutions.com/blog/essential-powershell-resources/
Get-Command -Module Microsoft*,Cim*,PS*,ISE | Get-Random | Get-Help -ShowWindow
Get-Random -input (Get-Help about*) | Get-Help -ShowWindow
View pathmanip.ps1
#http://powershell.com/cs/blogs/tips/archive/2014/09/08/useful-path-manipulation-shortcuts.aspx
[System.IO.Path]::GetFileNameWithoutExtension('file.ps1')
[System.IO.Path]::GetExtension('file.ps1')
[System.IO.Path]::ChangeExtension('file.ps1', '.copy.ps1')
[System.IO.Path]::GetFileNameWithoutExtension('c:\test\file.ps1')
[System.IO.Path]::GetExtension('c:\test\file.ps1')
[System.IO.Path]::ChangeExtension('c:\test\file.ps1', '.bak')
View gist:a66f2b084ffbaae5bc80
Fix error code 0x800F0906 when trying to install .NET 3.5 on Windows 8.1
dism /online /enable-feature /featurename:NetFx3 /all /source:d:\sources\sxs /limitaccess
View emailloggedinusers.ps1
#get usernames and email
#from http://www.reddit.com/r/PowerShell/comments/2acnqh/computerlist_filter_by_user/
$MachineList = Get-Content -Path H:\ListOfMachines.txt; # One system name per line
foreach ($machine in $MachineList){
$params = @{'ComputerName'=$machine;
'Namespace'='root\cimv2';
'Class'='Win32_ComputerSystem';
'ErrorAction'='SilentlyContinue'
}
$user = (Get-WmiObject @params).UserName
View Get-FullURL.ps1
<#
.Synopsis
Expands a shortened URL to its full URL
.DESCRIPTION
Expands a shortened URL to its full URL
.EXAMPLE
Get-FullURL http:/bit.ly/12345
#>
function Get-FullURL
{
View CommonShare.ps1
<#
.Synopsis
Maps commonly used network shares
.DESCRIPTION
Maps drives for commonly used network shares. Username parameter will map the drives as a specific user
.EXAMPLE
Mount-CommonShare
.EXAMPLE
Mount-CommonShare -Username stcxyz
#>
View Get-EventLogAudit.ps1
Function Get-EventLogAudit {
param (
$whichLog,
[datetime]$start,
[datetime]$end
)
$totalDays = ($end - $start).Days
$randomDay = $start.AddDays((Get-Random $totalDays))
$randomDayHour = $randomDay.AddHours((Get-Random 24))
View Play-SweetChildOMine.ps1
Function Play-SweetChildOMine {
#First Stanza
[System.Console]::Beep(587.3,200)
[System.Console]::Beep(1174.7,200)
[System.Console]::Beep(880,200)
[System.Console]::Beep(784,200)
[System.Console]::Beep(1568,200)
[System.Console]::Beep(880,200)
[System.Console]::Beep(1480,200)
[System.Console]::Beep(880,200)
View Play-Mario.ps1
Function Play-Mario {
[System.Console]::Beep(659, 125);
[System.Console]::Beep(659, 125);
[System.Threading.Thread]::Sleep(125);
[System.Console]::Beep(659, 125);
[System.Threading.Thread]::Sleep(167);
[System.Console]::Beep(523, 125);
[System.Console]::Beep(659, 125);
[System.Threading.Thread]::Sleep(125);
[System.Console]::Beep(784, 125);