Skip to content

Instantly share code, notes, and snippets.

View crshnbrn66's full-sized avatar

Thom Schumacher crshnbrn66

View GitHub Profile
@crshnbrn66
crshnbrn66 / user-profile.psm1
Last active December 19, 2023 17:53 — forked from MSAdministrator/Create-NewProfile.ps1
PowerShell functions to create a new user profile
<#
.Synopsis
Rough PS functions to create new user profiles
.DESCRIPTION
Call the Create-NewProfile function directly to create a new profile
.EXAMPLE
Create-NewProfile -Username 'testUser1' -Password 'testUser1'
.NOTES
Created by: Josh Rickard (@MS_dministrator) and Thom Schumacher (@driberif)
@crshnbrn66
crshnbrn66 / cortex.sh
Created September 21, 2023 17:33 — forked from szampardi/cortex.sh
use a json file for shell vars
#!/usr/bin/env bash
CORTEX_CRYPTO="aes-256-cbc"
_cortex_logger() { printf '{%s}[%s](%s):%s\t%s\n' "$(date -u '+%FT%TZ')" "${1}" "$(caller)" "${2}" "${@:3}" 1>&2; }
_cortex_io() {
case "${CORTEX_FILE}" in
"") _cortex_logger "$(caller)" ERR "CORTEX_FILE environment variable is empty/unset" && return 127 ;;
*)
function Start-ConnectionMonitoring
{
param($isp, $gateway, $Logfile,[int]$Delay = 10,[Ipaddress] $adapter, [switch]$ispPopup, [switch]$gateWayPopup)
$spacer = '--------------------------'
while($true)
{
if(!(Test-Connection $gateway -source $adapter -count 1 -ea Ignore))
{
get-date | Add-Content -path $Logfile
"$gateWay Connection Failure" |add-content -Path $Logfile

Keybase proof

I hereby claim:

  • I am crshnbrn66 on github.
  • I am crshnbrn66 (https://keybase.io/crshnbrn66) on keybase.
  • I have a public key ASDg8XSrh3XHkITuTYz09EtP2CEUPYp9pYH3-S1cZpL4AAo

To claim this, I am signing this object:

<#
.Synopsis
Sets folders specified retention flag to custom flag in Exchange online
.DESCRIPTION
This script is based from the following sources.
https://blogs.msdn.microsoft.com/akashb/2011/08/10/stamping-retention-policy-tag-using-ews-managed-api-1-1-from-powershellexchange-2010/
http://blogs.perficient.com/microsoft/2016/03/office-365-script-to-recreate-managed-folders-functionality/
This script search for and sets all folders found for the retention flag specified. See this blog post for more information:
.PARAMETER TargetMailboxes
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: 9ad32074-7adb-4822-a049-93600f966aa9
# Source File: ..\Documents\SAPIEN\Projects\Gui-SSRS-Deploy\Gui-SSRS-Deploy.psproj
#------------------------------------------------------------------------
#region Project Recovery Data (DO NOT MODIFY)
<#RecoveryData:
CAIAAB+LCAAAAAAABACNkV1rgzAUhu8L/Q/ifepHxU6IuVhdyy72QS27Had6HBkxkUTH/PeLU4dl
MHb5JO95XnJCT1ioD9R9Bi2w9cpx6LNW71i032DxBbXhSrJgE1BvhunuwAXeZyyBchv6u4jsoLyQ
6CYMCfhRQpJt7PtVEscACfWm8DQ6tZz7BplPvSXOciVKW+d4yzYzwYTOCSvUKAt8hBpT13VuOy7K
function get-redirectedUrls
{
Param($url)
$urlcheckobject=@{}
$Uri = [uri]$url
$url2check = $url
do{
$value = get-redirectedUrl -url $url2check
if($value.redirect)
{
function Get-FileNameProperties
{
param( $path = "~",
[switch] $Recurse,
[array]$Properties = ('Fullname', 'LastAccessTime', 'LastWriteTime', 'CreationTime','Owner','Size','Directory','Extension'))
$sortedfiles = $null
$files = Get-ChildItem -Recurse:$Recurse -File $path #if $recurse is true it'll recurse other wise it won't
$params2 = @()
# http://stackoverflow.com/a/13519264
#http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesystemrights%28v=vs.110%29.aspx
function Remove-PermissionsForGroup
{
<#
.Synopsis
Removes Ntfs permissions for the directory specified..
.DESCRIPTION
This script sets the ntfs permissions for the directory passed.
param($dacpacPath = 'c:\dacpacPath', $dacpac = 'your.dacpac')
add-type -path 'C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\Microsoft.SqlServer.Dac.Extensions.dll'
cd $dacpacPath
$model =[Microsoft.SqlServer.Dac.Model.TSqlModel]::new(((get-item ".\$dacpac").fullname))
$queryScopes = [Microsoft.SqlServer.Dac.Model.DacQueryScopes]::All
$returnObjects = $model.GetObjects([Microsoft.SqlServer.Dac.Model.DacQueryScopes]::All)
$s = ''
foreach($r in $returnObjects)
{
if ($r.TryGetScript([ref]$s))