Skip to content

Instantly share code, notes, and snippets.

View MSAdministrator's full-sized avatar
💭
Building Thangs

Josh Rickard MSAdministrator

💭
Building Thangs
View GitHub Profile
@MSAdministrator
MSAdministrator / PSnmap
Created June 17, 2016 04:34
This Gist is borrowed from someone else (see code), but i've slightly modified it to work with exe cmd switches.
#requires -version 2
<#
.SYNOPSIS
Linux nmap for PowerShell (almost).
Ping sweeps and scans a network for specified open ports. Can also perform DNS lookups.
Port connect timeout is custom (milliseconds).
Multithreaded with a default of 32 concurrent threads.
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>Selected.System.Management.Automation.PSCustomObject</T>
<T>System.Management.Automation.PSCustomObject</T>
<T>System.Object</T>
</TN>
<MS>
<S N="@odata.id">https://outlook.office365.com/api/v1.0/Users('mailbox@contoso.com')/Events('AAMkADc4NzFlMDc2LTdkNWMtNDg4MC04NmRmLTY5OTJmMmFhZjM2ZABGAAAAAAAyuDCxGFp8Q67E2z04c8bHBwAiBP0V5eP-QJuC8Y_Cu-MHAAAAAAENAAAiBP0V5eP-QJuC8Y_Cu-MHAABWVS42AAA=')</S>
<S N="@odata.etag">W/"IgT9FeXj/0CbgvGPgrvzBwAAWpeqCw=="</S>
#this is the actual call, but for this scripts focus it should be commented out
#$CalEvents = Invoke-RestMethod -Uri "https://outlook.office365.com/api/v1.0/users/me/calendarview?startDateTime=$(Get-Date)&endDateTime=$((Get-Date).AddDays(7))&`$top=10" -Credential $cred
#You an grab this from here: https://gist.github.com/MSAdministrator/bb18fa1d764aaaa64368edcdb36af35c
$CalEvents = Import-CliXML 'C:\users\$($env:username)\Desktop\CalEventsObject.xml'
$i = $(Get-Date)
foreach ($item in $CalEvents)
@MSAdministrator
MSAdministrator / Startup.pss
Created October 4, 2016 14:36
Startup Function for PowerShell Studio
function Main {
<#
.SYNOPSIS
The Main function starts the project application.
.PARAMETER Commandline
$Commandline contains the complete argument string passed to the script packager executable.
.NOTES
Use this function to initialize your script and to call GUI forms.
@MSAdministrator
MSAdministrator / Write-LogEntry
Created October 4, 2016 14:36
Write-LogEntry
#requires -Version 1
Function Write-LogEntry
{
param (
[string]$type,
[string]$message,
[string]$Folder,
[string]$CustomMessage
)
################################################################################
# Script: Generate-RandomUsersAndComputers.ps1
# Purpose: Creates random user and/or computer accounts in Active Directory
# with somewhat realistic properties in the top-level OU of your
# choice. If the OU does not exist, it will be created; the OU
# defaults to "NewEmployees" if another target OU is not given.
# Requires: PowerShell 2.0 or later, Server 2008-R2 or later domain controller,
# and you must run the script on the controller as a Domain Admin
# for the domain in the forest where you want the accounts created.
# Version: 1.0
<#
.Synopsis
A PowerShell function to expand IP Ranges with dashes
.DESCRIPTION
This function will take an array of IP address ranges and
split them out into single IP addresses
.EXAMPLE
Expand-IPRange -Range '192.0.0.1-192.0.0.100','192.0.0.150-192.0.10.1'
.EXAMPLE
Expand-IPRange -Range '192.0.0.1-192.0.0.100','192.0.0.140','172.0.0.1-172.0.1.240'
<#
.Synopsis
This function will convert a Saba CSV for University Campus
.DESCRIPTION
This function will import a CSV, modify the values, and export it to a new CSV.
We rename the following headers:
Person EMPID to EMPID
Completed Courses (Transcript) Ended/Completed On Date to Completed On Date
Course Course ID to Course ID
.EXAMPLE
@MSAdministrator
MSAdministrator / Convert-SabaToCampus2ndIssue.ps1
Created July 22, 2017 20:51
Convert-SabaToCampus2ndIssue
<#
.Synopsis
This function will convert a Saba CSV for University Campus
.DESCRIPTION
This function will import a CSV, modify the values, and export it to a new CSV.
We rename the following headers:
Person EMPID to EMPID
Completed Courses (Transcript) Ended/Completed On Date to Completed On Date
Course Course ID to Course ID
.EXAMPLE