Skip to content

Instantly share code, notes, and snippets.

View adilio's full-sized avatar
Just a boy. Sitting in front of a console. Asking it to do stuff.

Adil Leghari adilio

Just a boy. Sitting in front of a console. Asking it to do stuff.
View GitHub Profile
@adilio
adilio / Get-Appointment-via-EWS.ps1
Last active January 16, 2018 02:34
Get-Appointment-via-EWS
# Import the EWS Managed API
Import-Module 'C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll'
# Set Exchange version, credentials, and other variables
$ExchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP2
$Service = [Microsoft.Exchange.WebServices.Data.ExchangeService]::new($ExchangeVersion)
$User = "MY-SERVICE-ACCOUNT"
$Password = Get-Content MySuperSecureStringPassword.txt | ConvertTo-SecureString
$Service.Credentials = [System.Net.NetworkCredential]::new($User, $Password)
@adilio
adilio / Set-Preliminaries.ps1
Last active October 3, 2018 02:02
Preliminary config for win servers
# AnisbleMe.ps1
# Preliminary conifguration for a windows host
# Make sure Network profile is Private
$InterfaceId = (Get-NetConnectionProfile | Select-Object -ExpandProperty InterfaceIndex)
Set-NetConnectionProfile -InterfaceIndex $InterfacId -NetworkCategory Private
Write-Output "Interface Id $InterfaceId Network Profile set to Private"
# Enable Remote Desktop
Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Set-NetFirewallRule -Enabled true -Profile Private, Domain
@adilio
adilio / Copy-SpotlightImages.ps1
Last active May 7, 2023 16:15
Copies Windows Spotlight Images
<#
Copy-SpotlightImages.ps1
20181018 - 4dilio
Improved by https://www.reddit.com/user/Lee_Dailey/
Makes a copy of Windows Spolight images for your lockscreen,
and saves them to your $env:USERPROFILE\Pictures\Spotlight directory.
If the directory doesn't exist, it is created. Any image larger than
100 KB is copied, as some images in this folder are not wallpaper.
Also, files are renamed with date-stamp, along with first 8 charaters
of filename. This is just to help in sorting.
@adilio
adilio / Windows10-Setup.ps1
Created October 25, 2018 23:12 — forked from NickCraver/Windows10-Setup.ps1
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@adilio
adilio / Write-Log.ps1
Last active October 29, 2018 05:41
Simple function to write to a log file
<#
Write-Log.ps1
20181027 - 4dilio
Simple function to write to a log file.
You MUST define $Log in your script.
#>
function Write-Log {
[CmdletBinding()]
param(
@adilio
adilio / Test.md
Last active August 20, 2020 06:05

Compatibility

OS Family OS Name Version Module Tested Module Working
Linux RHEL Server 6 No No
Linux RHEL Server 7 No No
Linux Ubuntu Server 14.04 LTS No No
Linux Ubuntu Server 16.04 LTS No No
Windows Windows Server 2008 R2 No No
Windows Windows Server 2012 R2 No No
# Run this script in an elevated prompt, and quit and reload Slack after
$slackBaseDir = "C:\Program Files\Slack\"
$installations = Get-ChildItem $slackBaseDir -Directory | Where-Object { $_.Name.StartsWith("app-") }
$version = $installations | Sort-Object { [version]$_.Name.Substring(4) } | Select-Object -Last 1
Write-Output "Choosing highest present Slack version: $version"
$customContent = @'
// First make sure the wrapper app is loaded
@adilio
adilio / bootstrap.bat
Created February 24, 2019 09:33
VM Customization Bootstrap script, to prepare for Ansible management
@echo off
if "%1%" == "precustomization" (
echo No pre-customization tasks to run
) else if "%1%" == "postcustomization" (
echo Running post-customization tasks
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLUA /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
@adilio
adilio / Set-SlackDark.ps1
Created July 18, 2019 04:06
Enables Slack Dark Mode for versions 3.4.1 and later
# Author: Colin Andress
# Modified by: adilio
# Github Link: https://github.com/Column01
Write-Output 'Getting Windows User and Slack version'
$user = $env:UserName
if (Test-Path -Path "C:\Users\$user\AppData\Roaming\Slack\storage\slack-settings") {
$json = Get-Content "C:\Users\$user\AppData\Roaming\Slack\storage\slack-settings" | Out-String | ConvertFrom-Json
}
else {
Write-Output 'Unable to find the slack version info. Is slack installed from the windows store? Make sure it is from the slack website!'
@adilio
adilio / keybase.md
Created August 20, 2019 19:01
keybase

Keybase proof

I hereby claim:

  • I am adilio on github.
  • I am adilio (https://keybase.io/adilio) on keybase.
  • I have a public key ASAA457_y7Q9ce12VjfS7_kOWi4Bl_bLrqIZvqVA3RzStAo

To claim this, I am signing this object: