Skip to content

Instantly share code, notes, and snippets.

View paulvill76's full-sized avatar

Pablo Villaronga paulvill76

View GitHub Profile
Inspec Profile storage in Automate requires Automate >= 0.6.6, inspec >= 1.7.0
# login via inspec cli with data collector token
inspec compliance login_automate https://automate-server.test --insecure true --user admin --dctoken 93a49a4f2482c64126f7b6015e6b0f30284287ee4054ff8807fb63d9cbd1c506 --ent brewinc
# get user token
delivery token -u jmiller -s automate-server.test -e brewinc
# login with user token
inspec compliance login_automate https://automate-server.test --insecure true --user jmiller --usertoken tzwlbWMtgBC0lo6sxkAYKSShxSJEohnU7IAE4NCUGCg= --ent brewinc
@paulvill76
paulvill76 / dc-prep.ps1
Created September 30, 2018 08:55 — forked from Slusho/dc-prep.ps1
prep domain controller
<# Notes:
Goal - Prepare the local machine by installing needed PowerShell Gallery modules.
Disclaimer - This example code is provided without copyright and AS IS. It is free for you to use and modify.
Credit to Greg Shields
#>
Get-PackageSource -Name PSGallery | Set-PackageSource -Trusted -Force -ForceBootstrap
diff --git a/phpBB/styles/prosilver/template/memberlist_email.html b/phpBB/styles/prosilver/template/memberlist_email.html
index d9752be..eea699d 100644
--- a/phpBB/styles/prosilver/template/memberlist_email.html
+++ b/phpBB/styles/prosilver/template/memberlist_email.html
@@ -77,7 +77,7 @@
<dl>
<dt><label for="message">{L_MESSAGE_BODY}{L_COLON}</label><br />
<span>{L_EMAIL_BODY_EXPLAIN}</span></dt>
- <dd><textarea name="message" id="message" rows="15" cols="76" tabindex="4">{MESSAGE}</textarea></dd>
+ <dd><textarea class="inputbox" name="message" id="message" rows="15" cols="76" tabindex="4">{MESSAGE}</textarea></dd>
@paulvill76
paulvill76 / Migrate-ADMTUserCLI.ps1
Created April 10, 2019 14:04 — forked from RamblingCookieMonster/Migrate-ADMTUserCLI.ps1
This is an example function that wraps ADMT.exe, abstracting out migration of Active Directory users into a PowerShell function.
<#
This is a PowerShell function wrapping the ADMT executable to abstract out migrating Active Directory users.
Read all the ADMT docs, and all the code and comments below before considering using this : )
The COM object was covered nicely by Jan Egil Ring:
http://blog.powershell.no/2010/08/04/automate-active-directory-migration-tool-using-windows-powershell/
Unfortunately, the COM object does not support Include files, a critical requirement for us.
@paulvill76
paulvill76 / Get-ADGroup.ps1
Created April 11, 2019 15:44
New-ADGroup -Name "RODC Admins" -SamAccountName RODCAdmins -GroupCategory Security -GroupScope Global -DisplayName "RODC Administrators" -Path "CN=Users,DC=hlfr,DC=sh" -Description "Members of this group are RODC Administrators"
1
New-ADGroup -Name "RODC Admins" -SamAccountName RODCAdmins -GroupCategory Security -GroupScope Global -DisplayName "RODC Administrators" -Path "CN=Users,DC=hlfr,DC=sh" -Description "Members of this group are RODC Administrators"
2
Get-ADGroup FabrikamBranch1 -Properties Description | New-ADGroup -Name "Branch1Employees" -SamAccountName "Branch1Employees" -GroupCategory Distribution -PassThru
GroupScope : Universal

Credit: Mark Kraus
Website: https://get-powershellblog.blogspot.com

Collection Type Guidence

When to use what

  • Use Arrays if you know the element types and have a fixed length and/or known-up-front collection size that will not change.
  • Use ArrayList if you have an unkown collection size with either unknown or mixed type elements.
  • Use a Generic List when know the type of the elements but not the size of the collection.
  • Use a HashTable if you are going to do key based lookups on a collection and don't know the object type of the elements.
  • Use a Dictionary<TKey, TValue> you are going to do key based lookups on a collection and you know the type of the elements.
  • Use a HashSet when you know the type of elements and just want unique values and quick lookups and assignmnets.
@paulvill76
paulvill76 / gist:ed1a5b6352f06eadab6d15d48f7c4ba2
Created May 8, 2019 15:42 — forked from msidmvp/gist:7156615d507d49e8c0bafc3c72a50666
Adding AAD members to an AAD group based on CSV file
# Read in a list of user accounts from a CSV
#
# -- Begin sample CSV file --
# Username
# dtrump
# bobama
# gbush
# -- End sample CSV file --
#
$GroupObjectID = (Get-AzureADGroup -SearchString "your_groupname_here").ObjectID
VMSS
VMSS.ps1
@paulvill76
paulvill76 / processResponse.js
Created November 19, 2019 08:49 — forked from mikepfeiffer/processResponse.js
Client side code that processes the response from a demo Azure function
function processResponse(response) {
if (response.status === 200) {
output =
`
<div class="alert alert-success" role="alert">
Hello, ${document.getElementById('name').value}! It's nice to meet you!
</div>
`;
document.getElementById('output').innerHTML = output;
} else {
function Measure-ChildItem {
<#
.SYNOPSIS
Recursively measures the size of a directory.
.DESCRIPTION
Recursively measures the size of a directory.
Measure-ChildItem uses win32 functions, returning a minimal amount of information to gain speed. Once started, the operation cannot be interrupted by using Control and C. The more items present in a directory structure the longer this command will take.
This command supports paths longer than 260 characters.