Skip to content

Instantly share code, notes, and snippets.

View Tiberriver256's full-sized avatar
📚
Still learning

Micah Rairdon Tiberriver256

📚
Still learning
View GitHub Profile
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Connect-MsolService -credential $UserCredential
$ReportPath = "C:\filename"+ (Get-Date -UFormat %D).Replace("/",".") +".csv"
$Report = @()
@Tiberriver256
Tiberriver256 / gist:e3664c30c5e6e1db8622
Created March 28, 2016 14:15
SharePoint Development
cinst sharepointdesigner2013x64
cinst visualstudio2015community
cinst visualstudiocode
@Tiberriver256
Tiberriver256 / Get-DNSConfiguration.ps1
Created April 19, 2016 13:33 — forked from dotps1/Get-DNSConfiguration.ps1
Retrieves the DNS Servers from all IPEnabled Network Adapters.
<#
.SYNOPSIS
Retrives DNS Servers from a computer.
.DESCRIPTION
Retrives primary, secondary, tertiery DNS Servers from on online system with Windows Management Instrimentation.
.INPUTS
System.String.
.OUPUTS
System.Management.Automation.PSObject.
.PARAMETER ComputerName
Function Start-PoshWebGUI ($ScriptBlock)
{
# We create a scriptblock that waits for the server to launch and then opens a web browser control
$UserWindow = {
# Wait-ServerLaunch will continually repeatedly attempt to get a response from the URL before continuing
function Wait-ServerLaunch
{
try {
Function Out-JSONView {
[cmdletbinding()]
Param (
[parameter(ValueFromPipeline)]
[psobject]$InbutObject,
[int]$Depth = 2
Function Show-Diff {
param([String[]]$OldString,[String[]]$NewString)
$WebPage = @"
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
function Show-HTML ([string]$HTML)
{
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
[xml]$XAML = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PowerShell HTML GUI" WindowStartupLocation="CenterScreen">
<WebBrowser Name="WebBrowser"></WebBrowser>
@Tiberriver256
Tiberriver256 / Get-OrgChart.ps1
Created August 21, 2016 03:32
Get-OrgChart
function Get-ADdirectReports
{
PARAM ($SamAccountName)
$AllUsers = @()
$Manager = Get-Aduser -identity $SamAccountName -Properties DistinguishedName,CN,co,city,DisplayName,mail
$DirectReports = Get-ADUser -Filter {Manager -eq $Manager.DistinguishedName} -Properties manager
function new-PowershellWebGUI ($HTMLRaw,$Title,$Runspace) {
[xml]$xaml = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="$Title" Height="500" Width="700">
<Grid>
<DockPanel>
<WebBrowser Name="WebBrowser" DockPanel.Dock="Top" Margin="30">
</WebBrowser>
@Tiberriver256
Tiberriver256 / PSWebServer.psm1
Last active March 6, 2024 03:49
Sample of making a simple webserver in PowerShell. If you have more complex needs checkout Pode (https://github.com/Badgerati/Pode) as a fully fledged PowerShell web server.
Function New-PSWebServer {
<#
.Synopsis
Creates a web server that will invoke PowerShell code based on routes being asked for by the client.
.Description
New-PSWebServer creates a web server. The web server is composed of a schema that defines the client's requests to routes where PowerShell code is executed.
Under the covers, New-PSWebServer uses the HTTPListener .NET class to execute powershell code as requested, retrieves the results and sends data back through the httplistener web server framework.