Skip to content

Instantly share code, notes, and snippets.

View ned1313's full-sized avatar

Ned Bellavance ned1313

View GitHub Profile
@ned1313
ned1313 / Grant-LogOnAsService
Last active April 7, 2023 16:27
Grant user array log on as a service right in PowerShell
function Grant-LogOnAsService{
param(
[string[]] $users
)
#Get list of currently used SIDs
secedit /export /cfg tempexport.inf
$curSIDs = Select-String .\tempexport.inf -Pattern "SeServiceLogonRight"
$Sids = $curSIDs.line
@ned1313
ned1313 / cSqlServerInstall
Last active August 29, 2015 13:56
cSqlServerInstall
#
# cSQLServerInstall: DSC resource to install Sql Server Enterprise version.
#
#
# The Get-TargetResource cmdlet.
#
function Get-TargetResource
{
@ned1313
ned1313 / Get-VMStatistics.ps1
Created May 28, 2014 19:42
Horizon View PCoIP Performance Data Collection
# Horizon View VM Data Collection Script
param(
#Log file location (uses current directory by default)
[string] $logfilelocation=".\",
#CSV file location (uses current directory by default)
[string] $csvfilelocation=".\",
#PoolID (leave blank for all pools)
[string] $poolID
)
param($DomainController = [String]::Empty)
function Main
{
#Script Logic flow
#1. Pull User Info from cloud.csv file in the current directory
#2. Lookup AD Info (DN, mail, proxyAddresses, and legacyExchangeDN) using the SMTP address from the CSV file
#3. Save existing proxyAddresses
#4. Add existing legacyExchangeDN's to proxyAddresses
#5. Delete Mailbox
@ned1313
ned1313 / Create-NanoServerVM.ps1
Created May 15, 2015 14:35
Script to create a Nano Server VHD from Windows Server Technical Preview 2
<#
Create-NanoServerVM.ps1
Script by Ned Bellavance
This script is intended to take the Nano Server WIM file and transform it to a usable VHD with
the correct drivers for running as a Hyper-V guest. The necessary files for the Nano Server
come from the Server Technical Preview ISO. This should be mounted on the E: drive, otherwise
change the E: to wherever the ISO is mounted. This script should be run as an Administrator.
The script also assumes an internet connection to pull down the Convert-WindowsImage.ps1 script
from the script gallery. The VHD created from the process is intended to be run as a Version 1
@ned1313
ned1313 / Vagrantfile
Created October 20, 2015 20:26
Vagrant for Photon and Docker Compose for WordPress
Vagrant.configure(2) do |config|
config.vm.box = "vmware/photon"
config.vm.provider "vmware_desktop" do |v|
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.vmx["cpuid.coresPerSocket"] = "1"
end
config.vm.hostname = "dockerhost-prime"
<#
.SYNOPSIS
This script is intended to apply various policy settings to OneDrive for Business SharePoint sites.
.DESCRIPTION
The settings and policies include both user configurable and adminstrative options. Different policies can be
applied depending on the parameter set invoked.
.PARAMETER ApplyPreservationPolicy
Optional, switch parameter. When included, all OneDrive for Business sites will be checked to
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description" : "Template for the creation of an AutoScaling group with Domain Join",
"Metadata": {
"AWS::CloudFormation::Interface": {
"ParameterGroups": [
{
"Label": {
param(
[string] $ServerPrefix,
[pscredential] $credentials,
[string] $DCIpAddress
)
Write-Output "ServerPrefix: $ServerPrefix"
$names = Invoke-Command -ComputerName $DCIpAddress -ScriptBlock {param($searchString) Get-ADComputer -Filter * | Where{$_.Name -like "$($searchString)*"} | select Name} -Credential $credentials -ArgumentList $ServerPrefix
Write-Output "Names found: $names"
if($names -eq $null){$hostname = $ServerPrefix + "-01"}
else{
@ned1313
ned1313 / Create-EC2Snapshots.ps1
Created September 26, 2016 02:25
Create-EC2Snapshots.ps1
<#
.SYNOPSIS
This script is intended to tag the volumes of an existing instance and create a snapshot for those volumes.
.DESCRIPTION
The script takes an instance ID and optional region parameter. It will find the instance in the region submitted or the
current default region and find all volumes attached to the instance. Then it will tag those volumes, and create a snapshot.
The snapshot will include the volume tags, as well as a date and name tag of its own.
.PARAMETER instanceID
Required, string, the instanceID of the instance with volumes to have snapshots taken.
.PARAMETER region