Skip to content

Instantly share code, notes, and snippets.

View junecastillote's full-sized avatar

June Castillote junecastillote

View GitHub Profile
@junecastillote
junecastillote / Get-ServiceDependecyStatus.ps1
Last active September 29, 2023 16:06
Get the status of a service's required services
# Get-ServiceDependecyStatus.ps1
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[System.Object[]]
$ServiceList
)
foreach ($currentService in $ServiceList) {
try {
@junecastillote
junecastillote / Get-InstalledApps.ps1
Created September 18, 2023 15:00
PowerShell script to get installed apps using local or remote registry
## ORIGINALLY FROM - https://theitbros.com/how-to-get-list-of-installed-programs-in-windows-10
# Get-InstalledApps.ps1
[CmdletBinding()]
param (
[parameter()]
[switch]$Credential,
[parameter(ValueFromPipeline = $true)]
[String[]]$ComputerName = $env:COMPUTERNAME
)
@junecastillote
junecastillote / Get-BitLockerRecoveryPassword.ps1
Last active September 10, 2023 10:02
Get BitLocker Recovery Password from AD
# Get-BitLockerRecoveryPassword.ps1
[CmdletBinding(DefaultParameterSetName = 'byComputerName')]
param (
[Parameter(Mandatory, ParameterSetName = 'byComputerName')]
[string]
$ComputerName,
[Parameter(Mandatory, ParameterSetName = 'byKeyId')]
[string]
@junecastillote
junecastillote / Get-ADUserLastLogOnTime.ps1
Last active September 8, 2023 04:49
Get AD User LastLogon across the domain
# Get-ADUserLastLogOnTime.ps1
[CmdletBinding()]
param (
[Parameter()]
[String]
$LogonName
)
Import-Module ActiveDirectory
@junecastillote
junecastillote / Set-PnPSiteVersionLimit.ps1
Created September 6, 2023 08:33
Set SPO site versioning limit using PnP PowerShell
[CmdletBinding()]
param (
[Parameter(Mandatory)] [string[]] $SiteURL,
[parameter(Mandatory)] [int]$VersioningLimit,
[parameter(Mandatory)] [string]$ApplicationId,
[parameter(Mandatory)] [string]$Thumbprint,
[parameter(Mandatory)] [string]$Tenant,
[parameter()] [bool] $TestMode = $true
)
@junecastillote
junecastillote / Get_SPO_External_Users_All.ps1
Created August 18, 2023 18:00
Get All External Users on All SPO Sites
#Get_SPO_External_Users_All.ps1
# Get SharePoint Online Sites
$site = Get-SPOSite -Limit All
# Initialize the results placeholder arraylist
$externalUsers = [System.Collections.ArrayList]@()
for ($i = 0; $i -lt ($site.Count); $i++) {
# Set the initial position index to 0 (zero-based index).
@junecastillote
junecastillote / Get_SPO_External_Users.ps1
Created August 18, 2023 17:58
Get All External Users on Individual SPO Sites
#Get_SPO_External_Users.ps1
# Specify the SharePoint Online site URL.
$siteUrl = 'https://lazyexch.sharepoint.com/sites/CustomerSupportPortal'
# Initialize the results placeholder arraylist
$externalUsers = [System.Collections.ArrayList]@()
# Set the initial position index to 0 (zero-based index).
$positionIndex = 0
@junecastillote
junecastillote / Export-DLMembers.ps1
Created August 17, 2023 04:03
Export Distribution List Members PowerShell Script
# Export-DLMembers.ps1
[CmdletBinding()]
param (
[Parameter()]
$DistributionList
)
if ($DistributionList) {
try {
$group = Get-DistributionGroup -Identity $DistributionList -ErrorAction Stop
@junecastillote
junecastillote / parse-qwinsta-quser.ps1
Created August 5, 2021 15:53
Function to Parse Query User / Session
# Function to get the Sessions
Function Get-LoggedOnSessions {
param(
$Server = "localhost"
)
query session /server:$Server |
ForEach-Object {
$_.Trim() -replace '\s{2,}',','
} | ConvertFrom-Csv
}
@junecastillote
junecastillote / ListSiteLastAccessDate.sql
Created November 20, 2020 14:49
SPS 2003 SQL Queries
List Sites (Top URL, Sub URL, Site Name, Last Accessed
*/
USE
/* CHANGE THIS ---> */ DATABASENAME
SELECT
dbo.Sites.FullUrl AS [Top URL],
dbo.Webs.FullUrl AS [Sub URL],
dbo.Webs.Title AS [Site Name],
DATEADD(d,dbo.Webs.DayLastAccessed + 65536, CONVERT(datetime, '1/1/1899', 101)) AS [Last Accessed]