Skip to content

Instantly share code, notes, and snippets.

View davejlong's full-sized avatar

David Long davejlong

View GitHub Profile
@davejlong
davejlong / Import-GPOReports.ps1
Last active August 6, 2024 14:57
Imports all GPOs as Assets into Hudu. Requires an asset with an Embed field named "Policy Report"
# Add logic to install HuduAPI PowerShell Module
Import-Module HuduAPI
New-HuduAPIKey "****"
New-HuduBaseURL "*****"
$CompanyId = 42
$AssetLayoutID = 21
$ReportStore = C:\gpos
@davejlong
davejlong / init.vim
Created March 4, 2024 02:48
Basic Neovim config I use on systems.
" .config/nvim/init.vim
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Turn on the Wild menu
set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
@davejlong
davejlong / README.md
Created November 4, 2022 15:56 — forked from sukesh-ak/README.md
How to Convert OVA to VHDX

How to convert OVA to VHDX

  • Rename .OVA file to .7z
  • Use winrar to extract .vmdk out of it

Read here and install qemu (extract zip file)

https://cloudbase.it/qemu-img-windows/

qemu-img convert "D:\VirtualBox\Open-disk001.vmdk" -O vhdx -o subformat=dynamic "D:\VirtualBox\Open.vhdx"

@davejlong
davejlong / BGInfo deployment.bat
Created June 11, 2021 13:59
Deploys a BGInfo background to computer silently
reg add HKU\.DEFAULT\Software\Sysinternals\BGInfo /v EulaAccepted /t REG_DWORD /d 1 /f
\\SRV-01\Public\Software\BGInfo\Bginfo.exe \\SRV-01\Public\Software\BGInfo\Production_Background.bgi /TIMER:00 /nolicprompt /silent
###
# Author: Dave Long <[email protected]>
# Date: 2021-04-20
#
# Gets a list of all alerts for a host and exports them
# to a CSV
#
# Usage:
# $ Get-AlertsReport.ps1 -MachineName CONTOSO-DC-01
#
@davejlong
davejlong / Import-CustomerContacts.ps1
Last active April 21, 2021 20:32
Import users from Azure into Atera as contacts under a specified customer.
###
# Author: Dave Long <[email protected]>
# Date: 2021-04-21
#
# Imports users from Microsoft 365 into Atera Contacts
###
$AteraCustomerID = "<ATERA CUSTOMER ID>"
$AteraAPIKey = "<ATERA API KEY>"
@davejlong
davejlong / Get-CustomerContacts.ps1
Created December 7, 2020 15:14
Get all of the contacts in Atera along with the customer address information.
$Output = "$env:HOME\Contacts.csv"
$Customers = Get-AteraCustomers
$Contacts = Get-AteraContacts
# If you only want key contacts:
# $Contacts = Get-AteraContacts | Where IsContactPerson
foreach($Contact in $Contacts) {
$Customer = $Customers | Where CustomerID -eq $Contact.CustomerID
[PSCustomObject]@{
Import-Module -Name PSAtera
Import-Module -Name PnP.PowerShell
$CustomFieldLabel = "Scheduled For"
$SharePointSite = "https://contoso.sharepoint.com/sites/Contoso"
$List = "Calendar"
# I don't know enough about the PnP Module to connect to
# SharePoint better with MFA enabled
Write-Host "Connecting to SharePoint Online..." -NoNewline
@davejlong
davejlong / Set-OpenDNSServers.ps1
Created October 21, 2020 22:41
Check and set DNS for primary interface to OpenDNS
$DnsServers = @("208.67.220.220", "208.67.222.222")
$Route = Get-NetRoute -DestinationPrefix 0.0.0.0/0
$IfIndex = $Route.ifIndex
$DnsAddresses = Get-DnsClientServerAddress -InterfaceIndex $IfIndex -AddressFamily IPv4
$DnsAddresses.ServerAddresses | ForEach-Object {
if ($_ -notin $DnsServers) {
Write-Host "Fixing DNS Servers"
Set-DnsClientServerAddress -InterfaceIndex $IfIndex -ServerAddresses $DnsServers
@davejlong
davejlong / Set-ScheduledTickets.ps1
Last active August 28, 2020 14:47
Using the PSAtera module to automatically switch tickets from Pending to Open when the "Scheduled For" field is today.
Import-Module PSAtera -MinimumVersion 1.4.0
$Tickets = Get-AteraTicketsFiltered -Pending
foreach($Ticket in $Tickets) {
$ScheduledDate = Get-AteraCustomValue -ObjectType Ticket -ObjectID $Ticket.TicketID -FieldName "Scheduled For"
if ($null -eq $ScheduledDate.ValueAsDateTime) { return }
if ((Get-Date -Date $ScheduledDate.ValueAsDateTime) -le (Get-Date)) {
Set-AteraTicket -TicketID $Ticket.TicketID -TicketStatus "Open"
}
}