-
List Federated Microsoft Teams in Powershell
(Get-CsTenantFederationConfiguration).alloweddomains.alloweddomain
-
Get-MSOLUSERS MFA Status From Import-CSV
$UserPrincipalName=import-csv c:\temp\TEST-MFA-Enrolled.csv $UserPrincipalName.foreach( { Get-MsolUser -UserPrincipalName $_.Name | where {$_.StrongAuthenticationMethods -like “strong“} } ) | Export-Csv “C:\Temp\User-TO-BE-Added-EnrolledGroup.csv”
-
List The Extension Attributes in AZURE-AD
Get-EXORecipient -ResultSize unlimited -PropertySets Custom | Select Identity,CustomAttribute8,CustomAttribute12,CustomAttribute15
-
Install Application
#start the following Windows services in the specified order: [Array] $Services = ‘abc’,’abc’; #The KSASvcChk checks the status of both Kaseya services (Kaseya Agent:’KAKSAAS143744567159389′, Kaseya Agent Endpoint:’KAENDKSAAS143744567159389′) and outputs the status of both function KSASvcChk{ #Service Name paramater param($ServiceName) $arrService = Get-Service -Name $ServiceNameif ($arrService.Status -ne “Running”){Write $false}if ($arrService.Status -eq “running”){Write $true}else {Write $false}} #The…
-
GET AD Extension Attributes For All Users in Domain
Get-ADUser -Filter * -Properties * | Select Displayname,sAMAccountName, extensionAttribute15, extensionAttribute6,CanonicalName,proxyAddresses,UserPrincipalName
-
Inheritance user permissions to all organizations Units recursively
OU –> Properties –> Security –> add user or group –>then click on user or group –> Advance –> select same account –> Applies to “This object and All Descendant Objects
-
Use Multiple Filters in Powershell
$ou=’OU=subou3,OU=subou2,OU=subou1,DC=domain,DC=com’$filter = @(“machinename1”, “machinename2”)$compute= Get-ADComputer -Filter * -SearchBase $ou | where-object{$filter -contains $_.name}
-
Start the services in Any windows machines
start the following Windows services in the specified order: [Array] $Services = ‘winrm’,’TermService’; loop through each service, if its not running, start it foreach($ServiceName in $Services){$arrService = Get-Service -Name $ServiceNamewrite-host $ServiceNamewhile ($arrService.Status -ne ‘Running’){Start-Service $ServiceNamewrite-host $arrService.statuswrite-host ‘Service starting’Start-Sleep -seconds 60$arrService.Refresh()if ($arrService.Status -eq ‘Running’){Write-Host ‘Service is now Running’}}}