Wednesday, September 20, 2023

Get extension properties synced from on-premises to Azure AD

Module: AzureAD


Description
The Get-AzureADExtensionProperty cmdlet gets a collection that contains the extension properties registered with Azure Active Directory (Azure AD) through Azure AD Connect. You can get extension properties that are synced with on-premises Azure AD, those that are not synced with on-premises Azure AD, or both types.

Example:
Get extension properties synced from on-premises Azure AD


PS: Get-AzureADExtensionProperty -IsSyncedFromOnPremises $True


Wednesday, September 21, 2022

Database availability group server cannot be removed from database

I was decommissioning the old Exchange 2013 environment with Database Availability Group.

I got an error when removing the Exchange servers from the DAG: 

Error: “Database availability group server EXCHANGESERVER cannot be removed from database availability group DAG since it is currently set for datacenter activation mode and it requires at least two mailbox servers.”
I tried again in PowerShell

Remove-DatabaseAvailabilityGroupServer -Identity <DAGName> 
-MailboxServer <ExchangeServer>

Tuesday, September 20, 2022

Помилка при видаленні Exchange сервера з Database Availability Group

Виводив з експлуатації старе середовище Exchange 2013 з багатьма Database Availability Group.

Отримав повідомлення про помилку під час видалення Exchange серверів з DAG:


Error: “Database availability group server EXCHANGESERVER cannot be removed from database availability group DAG since it is currently set for datacenter activation mode and it requires at least two mailbox servers.”

Я спробував ще раз у PowerShell

[PS]Remove-DatabaseAvailabilityGroupServer -Identity <DAGName> 
-MailboxServer <ExchangeServer>


Sunday, April 3, 2022

Basic PowerShell Commands

Get Execution Policy

Get-ExecutionPolicy

Set Execution Policy to Unrestricted

Set-ExecutionPolicy Unrestricted

Show PowerShell Version

$PSVersionTable

Get help for a command
Use this to get the help information for a command
Get-Help <cmdlet-name>

Search Get Help
Use this to search the help files. This is useful if you don’t know the command or want to see if one exists.
Get-Help *keyword*

Get Installed Modules
Use this command to display all the installed modules on a computer 
Get-InstalledModule

List All Available Modules
This will list all available modules on the computer.
Get-Module -ListAvailable

Get Installed Modules
Use this command to display all the installed modules on a computer
Get-Module -ListAvailable

Display available commands
This will display all commands that are available based on the modules that are loaded.
Get-Command


Monday, October 4, 2021

Windows 11: release information

Windows 11, version 21H2
(OS build 22621)

Windows 11, version 21H2 (original release)
(OS build 22000)


External links
Windows 11 release information

Monday, September 27, 2021

PowerShellTip: Get Get AD Domain Controllers operating system


Get-ADDomainController -Filter * | Select-Object Name, OperatingSystem





PowerShellTip: Get AD Global Catalog status from all DC


 
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers | %{"$($_.Name) : $($_.isglobalcatalog())"}

Wednesday, March 3, 2021

Multiple Security Updates Released for Exchange Server - March 2021

Microsoft released patches for multiple different on-premises Microsoft Exchange Server zero-day vulnerabilities The vulnerabilities exist in on-premises Exchange Servers 2010, 2013, 2016, and 2019.

More info:
HAFNIUM targeting Exchange Servers with 0-day exploits

Saturday, December 12, 2020

SECURITY UPDATES EXCHANGE SERVER - DECEMBER 2020

On December 8, 2020 Microsoft released a number of security updates for Exchange server. Despite the fact that Exchange 2010 is out of support at all, an important security update for Exchange 2010 was released as well.

Exchange versionKB ArticleDownload
Exchange 2010 SP3 RU31KB4593467Download
Exchange 2013 CU23KB4593466Download
Exchange 2016 CU17KB4593465Download
Exchange 2016 CU18KB4593465Download
Exchange 2019 CU6KB4593465Download
Exchange 2019 CU7KB4593465Download

Monday, May 11, 2020

PowerShell Script: Get Inactive AD Users


Simple script to show inactive Active Directory users. Export data to CSV.
Based on Last Logon Time Stamp.

Link for download:
Get-InactiveADUsers-CSV.ps1


Tuesday, April 21, 2020

How to view Msol User Groups in Powershell

Sometimes th administrator needs to know which groups the Office 365 user is member of.
You can use the command Get-MsolUserGroup to resolve this issue.

Installtion
Install-Module -Name Microsoft365.Toolbox

Usage
Import-Module ActiveDirectory.Toolbox

Commands
Get-MsolUserGroup [-UserPrincipalName]





Note:
#Requires -Modules MSOnline

Monday, February 17, 2020

Happy Birthday, Active Directory!


 


Image result for active directory 2000
 
Introduction of Active Directory to the world was part of the release of Windows 2000 Server on February 17, 2000.

Happy Birthday 20th, Active Directory!

Friday, February 14, 2020

How to view BitLocker Recovery Key in PowerShell


Installtion

PS> Install-Module -Name ActiveDirectory.Toolbox


Usage

PS> Import-Module ActiveDirectory.Toolbox



Commands

Get-ADComputerBitLockerInfo [[-ComputerName] <string[]>]

or

Get-ADComputerBitLocker [[-ComputerName] <string[]>]

Note:
#Requires -Modules ActiveDirectory

How to view LAPS password in PowerShell

Installtion
PS> Install-Module -Name ActiveDirectory.Toolbox
Usage

PS> Import-Module ActiveDirectory.Toolbox




Commands

Get-ADComputerLAPSInfo [[-ComputerName] <string[]>]

or

Get-ADComputerLAPS [[-ComputerName] <string[]>]




Link for download


Note:
#Requires -Modules ActiveDirectory

Wednesday, November 20, 2019

How to Check for Administrator Privileges in a PowerShell Script?

If you need to run PowerShell script with administrator privileges, you can directly check the current process for administrative privileges directly in the PS code.

The following PowerShell code can be used to check if the current script is running in “Run as Administrator” mode or not:

function Check-PSAdminPermission (){
   if (-NOT ([Security.Principal.WindowsPrincipal]`
      [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
      [Security.Principal.WindowsBuiltInRole] "Administrator")) {
         Return $false
   }
   else {
         Return $true
   }
}
 
Write-Host "Checking for administrative privileges …"
if (Check-PSAdminPermission) {
    Write-Host "Administrator permission detected" -ForegroundColor Green
}
else {
   Write-Host "Not enough rights to run this script `nOpen the PowerShell console with administrator privileges and run the script again" -ForegroundColor Yellow
    Break
}
 
Write-Host "Continue the script..."

Tuesday, August 20, 2019

PowershellTip: Show Installed Windows Roles and Features

List all installed Features and Roles

Example 1:
 
Get-WindowsFeature | Where-Object {$_. installstate -eq "installed"}
 

Example 2:
 
Get-WindowsFeature | where-object {$_.Installed -eq $True} | Format-List DisplayName
 
 
 
Example 3:
 
Get-WindowsFeature | Where-Object {$_. installstate -eq "installed"} | Format-List Name, Installstate
 
 

List all roles and Features on a Remote Host

Get-WindowsFeature -ComputerName <ComputerName> | Where-Object {$_. installstate -eq "Installed"}
 
 
 
 

Friday, August 16, 2019

PowerShellTip: Move AD Group to another OU

 
Import-module ActiveDirectory
Get-ADGroup MyGroup | Move-ADObject -identity {$_.objectguid} -TargetPath 'ou=GroupsToDelete,dc=MyCompany,dc=com'