Skip to content

Instantly share code, notes, and snippets.

View lazywinadmin's full-sized avatar

François-Xavier Cat lazywinadmin

View GitHub Profile
@lazywinadmin
lazywinadmin / blogspot_to_jekyll.rb
Created September 5, 2016 02:07 — forked from kennym/blogspot_to_jekyll.rb
Migrate your blogger blog posts to jekyll.
#!/usr/bin/env ruby
#
# Convert blogger (blogspot) posts to jekyll posts
#
# Basic Usage
# -----------
#
# ./blogger_to_jekyll.rb feed_url
#
# where `feed_url` can have the following format:
ipmo PSDesiredStateConfiguration
# Reveal non-Exported commands in a module
$m = Get-module PSDesiredStateConfiguration
& $m {Get-Command -module PSDesiredStateConfiguration}
function Get-Uptime {
[timespan]::FromSeconds([double][System.Diagnostics.Stopwatch]::GetTimestamp() / [double][System.Diagnostics.Stopwatch]::Frequency)
}
@lazywinadmin
lazywinadmin / Get-Excuse.ps1
Last active February 17, 2016 15:30
Get an excuse
#requires -Version 3
# http://powershell.com/cs/blogs/tips/archive/2016/02/17/getting-an-excuse.aspx
function Get-Excuse
{
$url = 'http://pages.cs.wisc.edu/~ballard/bofh/bofhserver.pl'
$ProgressPreference = 'SilentlyContinue'
$page = Invoke-WebRequest -Uri $url -UseBasicParsing
$pattern = '(?m)<br><font size = "\+2">(.+)'
if ($page.Content -match $pattern)
{
@lazywinadmin
lazywinadmin / Out-Notepad.ps1
Created February 12, 2016 14:45
Send the output to Notepad
#requires -Version 2
#http://powershell.com/cs/blogs/tips/archive/2016/02/11/send-text-to-notepad.aspx
function Out-Notepad
{
param
(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[String]
[AllowEmptyString()]
$Text
@lazywinadmin
lazywinadmin / Watch_PowerShellBlog.ps1
Created February 9, 2016 00:58
Watch PowerShell blog for updates
$Regex = [regex]'<strong>Updated\s01/20/2016</strong>'
do {
$Site = Invoke-WebRequest -Uri 'https://blogs.msdn.microsoft.com/powershell/2015/12/23/windows-management-framework-wmf-5-0-currently-removed-from-download-center/'
Start-Sleep -Seconds 60
} while ($Site.Content -match $Regex)
while (1) {
[System.Console]::Beep()
Get-Command -Name Write* -CommandType Cmdlet | Where-Object {$_.Name -notmatch 'Event|Progress|Debug'} | ForEach-Object {
Invoke-Expression "$($_.Name) 'There is news on WMF 5.0' -Verbose"
}
@lazywinadmin
lazywinadmin / Converting _To_The_Localtime.ps1
Last active February 10, 2016 22:44
Convert UTC DateTime to a localtime
#http://www.powershellmagazine.com/2014/07/08/pstip-converting-to-the-local-time/
# Convert a time to local time
[System.TimeZone]::CurrentTimeZone.ToLocalTime("Tuesday, February 2, 2016 2:48:39 PM")
# Convert a time to UTC time
[System.TimeZone]::CurrentTimeZone.ToUniversalTime("2016/02/10 01:00 PM")
# Get the Daylight Name
[System.TimeZone]::CurrentTimeZone.DaylightName
@lazywinadmin
lazywinadmin / Path_sorted.ps1
Created February 1, 2016 15:37
Sort all the paths present in the PATH variable
$env:path -split ";"|sort
@lazywinadmin
lazywinadmin / Get-ProcessInfoUI.ps1
Created February 1, 2016 15:31
Get UI Information for Processes
<# PowerShell.Com
PowerShell can use UIAutomation calls to find out useful UI information about any process.
You can find out whether a process accepts keyboard input, whether it is currently visible
(and what its window dimensions are), and whether it is a native Win32 application
or uses WPF--among other things.
Here is an example that examines two processes: the PowerShell window, and a minimized Notepad:
@lazywinadmin
lazywinadmin / Test_Repair_ComputerSecureChannel.ps1
Created January 31, 2016 03:05
Tests and repairs the secure channel between the local computer and its domain
#https://technet.microsoft.com/en-us/library/hh849757.aspx
Test-ComputerSecureChannel -Credential contoso.local\admin -Repair