Posts tagged with "PowerShell"


How to Find Your Public IP Address

A collection of methods to retrieve your public IP address using command-line tools like nslookup, curl, and PowerShell, as well as web-based solutions.

Published: June 24, 2024 | Last Modified: May 13, 2025

Visualizing and Analyzing Windows Folder Permissions

A comprehensive guide to exporting and visualizing Windows folder permissions using PowerShell and Python, including treemap visualizations of user access rights.

Published: June 1, 2024 | Last Modified: May 13, 2025

Active Directory User Lockout and Password Report

A PowerShell script that generates an HTML diagnostics report for user lockouts in Active Directory, including password age, expiration details, and account status.

Published: May 30, 2024 | Last Modified: May 13, 2025

Troubleshooting N-Central Take Control

Steps to take when N-Central’s Take Control remote access feature isn’t working, including how to restart the necessary services.

Published: January 2, 2024 | Last Modified: June 10, 2025


Mapping Network Drives Using PowerShell and SID

This blog post discusses a PowerShell script that can map a network drive using a Security Identifier (SID), even without being logged in as that user.

Published: July 20, 2023 | Last Modified: May 13, 2025


Windows ACL Management with PowerShell

A comprehensive collection of PowerShell scripts for managing Windows Access Control Lists (ACLs), including permission enumeration, modification, and analysis tools with detailed permission descriptions.

Published: May 2, 2023 | Last Modified: May 13, 2025

Managing Global Address List (GAL) Visibility with PowerShell

A comprehensive guide to managing user visibility in the Global Address List (GAL) using PowerShell, covering both on-premises Active Directory and Exchange Online environments with detailed scripts for checking and modifying the msExchHideFromAddressLists attribute.

Published: April 5, 2023 | Last Modified: May 13, 2025

Windows Remediation

A comprehensive collection of Windows troubleshooting and repair tools including DISM, SFC, DLL registration commands, and PowerShell scripts for reinstalling Windows apps.

Published: March 3, 2023 | Last Modified: May 13, 2025

Microsoft LAPS (Local Administrator Password Solution) Guide

Microsoft LAPS (Local Administrator Password Solution) is a tool designed to securely manage local administrator account passwords on Windows domain-joined computers. It automates password generation and rotation, and stores passwords in a secure manner, providing greater control and security over local accounts.

Published: February 23, 2023 | Last Modified: May 13, 2025

Microsoft Teams PowerShell Management Guide

PowerShell scripts for Microsoft Teams stuff.

Get all owners of all teams and team channels

## Documentation: https://learn.microsoft.com/en-us/powershell/module/teams/?view=teams-ps
 
# Run the following command to install the latest PowerShellGet:
Install-Module -Name PowerShellGet -Force -AllowClobber
 
# Install the Teams PowerShell Module.
Install-Module -Name MicrosoftTeams -Force -AllowClobber
 
# To start working with Microsoft Teams PowerShell module, sign in with your Azure credentials.
Connect-MicrosoftTeams
 
$user =Read-Host -Prompt 'Input the user name'
$teams = Get-Team -User $user
$teamMemberships=@()
$teamChannels=@()
$teamChannelMemberships=@()
 
$i = 1

$teamMemberships = foreach ($team in $teams) {
    $GroupId = $team.GroupId   
    
    Get-TeamUser -GroupId $GroupId | Select-Object *,@{Name="GroupId";Expression={$GroupId}}
    $channels = Get-TeamAllChannel -GroupId $GroupId | Select-Object *,@{Name="GroupId";Expression={$GroupId}}
    $teamChannels += $channels

    $teamChannelMemberships += foreach ($channel in $channels) {
        $channelDisplayName = $channel.DisplayName
        Get-TeamChannelUser -GroupId $GroupId -DisplayName $channelDisplayName | Select-Object *,@{Name="GroupId";Expression={$GroupId}}
    }

    $percent = [Math]::Round((100 * $i) / $teams.Length)
    Write-Progress -Activity "Search in Progress" -Status "$percent% complete"
    $i++
    }

$teams | Export-Csv -Path "teams.csv" -NoTypeInformation
$teamMemberships | Export-Csv -Path "team-memberships.csv" -NoTypeInformation
$teamChannels | Export-Csv -Path "team-channels.csv" -NoTypeInformation
$teamChannelMemberShips | Export-Csv -Path "team-channel-memberships.csv" -NoTypeInformation

Published: February 23, 2023 | Last Modified: May 13, 2025

PowerShell Script for Azure AD Synchronization Management

This PowerShell script performs the following actions:

  1. It retrieves the Windows identity and security principal of the current user account.
  2. It then retrieves the security principal for the Administrator role.
  3. It checks if the current user is running as an administrator. If the user is not running as an administrator, the script relaunches itself as an elevated process.
  4. If the user is running as an administrator, the script displays a menu with three options: “Delta Sync”, “Full Sync”, and “Exit”. The user is prompted to select an option by entering the corresponding number.
  5. Based on the user’s selection, the script runs the appropriate command using the Start-ADSyncSyncCycle cmdlet with either the Delta or Initial policy type. If the user selects “Exit”, the script exits.
  6. Finally, the script displays a message indicating that it is running and to check the “miisclient” to confirm. It then pauses for 10 seconds using the Start-Sleep cmdlet.
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($myWindowsID)
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator

if (-not $myWindowsPrincipal.IsInRole($adminRole)) {
    $newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell"
    $newProcess.Arguments = $myInvocation.MyCommand.Definition
    $newProcess.Verb = "runas"
    [System.Diagnostics.Process]::Start($newProcess)
    exit
}

Write-Host '1) Delta Sync (Recommended, unless told to do a full sync)'
Write-Host '2) Full Sync'
Write-Host '3) Exit'

$selected_menu_item = Read-Host 'Which number would you like to run (1 or 2)? (Enter Number and Press Enter)'

switch ($selected_menu_item) {
    1 { Start-ADSyncSyncCycle -PolicyType Delta }
    2 { Start-ADSyncSyncCycle -PolicyType Initial }
    3 { Write-Host 'Exit'; exit }
    default { Write-Host 'Incorrect Input' -ForegroundColor Red }
}

Write-Host 'Running Now.... Check miisclient to confirm'
Start-Sleep -s 10

Published: February 9, 2023 | Last Modified: May 13, 2025

Microsoft 365 Email Security Management Guide

Block Unwanted Emails

Objective: Prevent sending or receiving emails from specific external email addresses or domains.

Action: Navigate to the Tenant Allow/Block List in the Microsoft Security Center. Configure the settings to block specific email addresses or domains. For direct access, use this link: Tenant Allow/Block List.

Review Past Week of Sign-In History

Objective: Review sign-in history to identify any unusual user activity.

Action: Access the Azure portal’s sign-in history section. Specify the user of interest and examine their sign-in locations and activities. Access the portal here: Azure Sign-In History.

Published: February 7, 2023 | Last Modified: May 13, 2025

Mastering Time with Shell and PowerShell

A comprehensive guide to Windows time management using shell and PowerShell commands, covering system uptime, boot times, time synchronization, and timezone configuration.

Published: February 2, 2023 | Last Modified: May 13, 2025

PowerShell Script to Export WiFi Network Credentials

A PowerShell script that automates the extraction of stored WiFi network credentials using netsh commands, exporting SSIDs and passwords to a CSV file for easy management and reporting.

Published: April 11, 2022 | Last Modified: May 13, 2025

Combining PowerShell Cmdlets

A PowerShell script demonstrating the integration of ExchangeOnlineManagement and AzureAD modules to generate comprehensive email troubleshooting reports by correlating data through UserPrincipalName matching.

Published: November 17, 2021 | Last Modified: May 13, 2025

Get Group Membership

PowerShell scripts for extracting and reporting group membership information from both on-premises Active Directory and Azure AD, featuring progress tracking and CSV export functionality.

Published: September 16, 2021 | Last Modified: May 13, 2025

Managing Exchange Calendars

A collection of PowerShell scripts using ExchangeOnlineManagement module to manage calendar permissions in Exchange Online, including bulk operations for granting, modifying, and viewing access rights across multiple mailboxes.

Published: September 16, 2021 | Last Modified: May 13, 2025


Remote Reboot With SMTP Status

A PowerShell script that remotely reboots a specified computer and sends an email notification about the reboot status using SMTP.

Published: August 28, 2019 | Last Modified: May 13, 2025

Remove-AppxPackages

A PowerShell script that removes unwanted Windows Store apps (AppX packages) while preserving essential system apps, using a list of package names to exclude from removal.

Published: August 28, 2019 | Last Modified: May 13, 2025

Enable AutoAdminLogon with PowerShell

A PowerShell script that enables AutoAdminLogon by configuring registry settings to automatically log in a specified user without prompting for credentials.

Published: August 19, 2019 | Last Modified: May 13, 2025