Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
ciphertxt / azure_expiringsps.sh
Created July 13, 2020 19:43
Find all Service Principals with credentials expiring in the next 60 days
az ad sp list \
--all \
--query "[?passwordCredentials[0].endDate<='$(date -d "+60 days" +%Y-%m-%d)'||keyCredentials[0].endDate<='$(date -d "+60 days" +%Y-%m-%d)'].{\"App ID Display Name\":appDisplayName,\"SP appId\":appId,\"Password Expiry Date\":passwordCredentials[0].endDate, \"Key Expiry Date\":keyCredentials[0].endDate}" \
-o table
$tokenPoSh = ((New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient([Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile)).AcquireAccessToken((Gaz account get-access-tokenId)).AccessToken
$tokenCLI = az account get-access-token --query "accessToken"
#!/bin/bash
# Update the package index
sudo apt-get update
# Install the latest version of docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# add current user to the docker group
@ciphertxt
ciphertxt / installandupdateiis.ps1
Created July 10, 2019 13:21
Install IIS and Update Start Page with Computer Name
Add-WindowsFeature Web-Server; powershell Add-Content -Path "C:\inetpub\wwwroot\Default.htm" -Value $($env:computername)
@ciphertxt
ciphertxt / mbp2011-disable-amd-gpu.md
Created January 4, 2019 17:04 — forked from blackgate/mbp2011-disable-amd-gpu.md
Macbook Pro 2011 - Disable AMD GPU
@ciphertxt
ciphertxt / create-iso.sh
Created August 19, 2017 13:07 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@ciphertxt
ciphertxt / Get-ADUsersWithNoEmployeeID.ps1
Created June 9, 2016 16:09
Returns a listing of users from Active Directory with no employeeid (who are enabled)
get-aduser -filter {-not(employeeid -like "*") -and (enabled -eq $true)} -properties * | select userprincipalname, samaccountname, surname, givenname, sid, employeeid | export-csv ~\Downloads\ADUsersWithNoEmployeeID.csv -NoTypeInformation
@ciphertxt
ciphertxt / Get-ADUsersWithNoOffice.ps1
Created June 9, 2016 16:08
Returns a listing from Active Directory of users without an office location who are enabled.
get-aduser -filter {-not(office -like "*") -and (enabled -eq $true)} -properties * | select userprincipalname, samaccountname, surname, givenname, sid, office | export-csv ~\Downloads\ADUsersWithNoOffice.csv -NoTypeInformation
@ciphertxt
ciphertxt / Get-EXOMailboxSizes.ps1
Last active May 27, 2016 13:20
Retrieves CSV with mailbox consumption and quotas for Office 365/Exchange Online
$cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
$mailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($mailbox in $mailboxes) {
$mbSize = 0
$mbSizeText = (Get-MailboxStatistics -Identity $mailbox.UserPrincipalName).TotalItemSize
if ($mbSizeText -ne "Unlimited") {
$mbSize = ((Get-MailboxStatistics -Identity $mailbox.UserPrincipalName).TotalItemSize -replace “(.*\()|,| [a-z]*\)”, “”)
@ciphertxt
ciphertxt / Get-MsolRolesAndMembers.ps1
Created May 10, 2016 12:43
Retrieves a list of current roles and the associated role members in an Office 365 tenant.
Import-Module MSOline -EA 0
Connect-MsolService -Credential (Get-Credential)
$admins=@()
$roles = Get-MsolRole
foreach ($role in $roles) {
$roleUsers = Get-MsolRoleMember -RoleObjectId $role.ObjectId