Run Sysinternals from the live location https://live.sysinternals.com/
Run the below command to add the path to your environment variables:
SETX PATH "%PATH%;\\live.sysinternals.com\tools;"About: Exchange 2013-2016-2019-Online - Powershell - Windows 2012-2016-2019 - Teams - Office365 - PKI - Microsoft365
Run Sysinternals from the live location https://live.sysinternals.com/
Run the below command to add the path to your environment variables:
SETX PATH "%PATH%;\\live.sysinternals.com\tools;"We couldn't sign you in. Please try again.
And then your in a loop. Clearing the browser cache helps sometimes, but that's not the real reason why you are seeing this error.Get-AzureADDirectorySetting : The term 'Get-AzureADDirectorySetting' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.And
Get-AzureADDirectorySetting : The term 'Get-AzureADObjectSetting' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
That's strange, the command does get completed when tabbing after typing get-azureaddir.
The problem is it's an AzureADPreview module commandlet, so you have to connect to AzureAd from that module like so:
Connect to AzureAD with a specific module:
AzureADPreview\Connect-AzureAD
Bulk invite guest users:
<# .NOTES Name : Add-BulkGuests.ps1 Author : Edwin van Brenk Version : 1.0 Date : 08-04-2021 Requires : PowerShell v2 or higher AzureAD module .SYNOPSIS - .DESCRIPTION Bulk invite guest users in your AzureAD tenant .PARAMETER - .EXAMPLE - .CSV FILE The csv need to look like this: DisplayName,EmailAddress firstname lastname,firstname.lastname@domain.com #> # Connect to your tenant Connect-AzureAD # Import the csv file $guests = Import-Csv C:\temp\BulkGuests2.csv # Invite all users in the imported csv file foreach ($guest in $guests) { # Function Variables $emailaddress = $guest.EmailAddress $displayname = $guest.DisplayName New-AzureADMSInvitation -InvitedUserEmailAddress $guest.emailaddress -InvitedUserDisplayName $guest.displayName -InviteRedirectUrl https://myapplications.microsoft.com -SendInvitationMessage $True Write-Host "Invite sent to $emailaddress" -ForegroundColor Green } Write-Host Finished
Update the managers for the newly invited guests:
<# .NOTES Name : Update-GuestManager.ps1 Author : Edwin van Brenk Version : 1.0 Date : 08-04-2021 Requires : PowerShell v2 or higher AzureAD module Az.Accounts .SYNOPSIS - .DESCRIPTION Update guest users in your AzureAD tenant with the correct manager .PARAMETER - .EXAMPLE - .CSV FILE The csv needs to look like this: User,Manager firstname lastname,manageremailaddress@domain.com #> # Connecting to AzureAD Connect-AzureAD Connect-AzAccount # Importing the CSV source which has the changes $data = Import-Csv C:\Temp\Bulk\Manager.csv # Iterating through each row in the CSV foreach ($row in $data) { # Find the user and the manager $user = Get-AzureADUser -SearchString $row.User | select objectid $manager = Get-AzADUser -UserPrincipalName $row.Manager | Select Id # Updating the manager Set-AzureADUserManager -ObjectId $user.objectid -RefObjectId $manager.id # Completion info in the console for the specified row Write-Host "Updated "$row.user"" -ForegroundColor Green # Clear the variable for the next row $user = $null $manager = $null } Write-Host "Finished" -ForegroundColor Green
Quickly get the Computer Name, Model, Make, and other useful information
Get-WMIObject -Class Win32_ComputerSystem information about the System Get-WMIObject -Class Win32_BIOS Information about the BIOS Get-WMIObject -Class Win32_Baseboard Information about the Motherboard Get-WMIObject -Class Win32_Processor Information about the CPU Get-WMIObject -Class Win32_LogicalDisk Information about Logical Drives (Includes mapped drives and I believe PSDrives) Get-WMIObject -Class Win32_DiskDrive Information about Physical Drives Get-WMIObject -Class Win32_PhysicalMemory Information about the Memory Get-WMIObject -Class Win32_NetworkAdapter Information about the NIC Get-WMIObject -Class Win32_NetworkAdapterConfiguration Information about the NICs Configuration
$PSVersionTable
Get-NetAdapter | Restart-NetAdapter
cd \\servername\C$\Path\To\File
$Users = Get-ChildItem C:\Users\ -Exclude “Administrator”,”Public”,”Default*” # Exclude any other defaults that you don’t want. foreach($User in $Users.name){ $Path = “C:\Users\$User\Desktop”; Copy-Item -Path “\\Path\To\Source\File.txt” -Destination $Path\File.txt }
$Drive=Get-WmiObject Win32_LogicalDisk -Filter “DriveType = 3” $DriveSize=$Drive.Size;$DriveSize=[math]::Round($DriveSize/1GB) $FreeSpace=$Drive.FreeSpace;$FreeSpace=[math]::Round($FreeSpace/1GB) $DriveName=$Drive.Name $ComputerName=Get-WmiObject Win32_ComputerSystem;$ComputerName=$ComputerName.Name $UsedSpace=$DriveSize – $FreeSpace;$UsedSpace=[string]$UsedSpace+” GB free on drive $DriveName on computer $ComputerName”
Credit for the script goes to Jan-Henrik Damaschke at https://www.itinsights.org
function Set-WakeEnabled
{ <# .SYNOPSIS Set WoL on nic Author: Jan-Henrik Damaschke (@jandamaschke) License: BSD 3-Clause Required Dependencies: None Optional Dependencies: None .DESCRIPTION Set Wake on Lan (WOL) settings for specific network interface card .PARAMETER InterfaceName Specifies the name of the interface where WoL setting should be changed .PARAMETER WakeEnabled Specifies if WoL should be enabled or disabled .EXAMPLE PS C:\> Set-WakeEnabled -InterfaceName Ethernet -WakeEnabled $true .LINK http://itinsights.org/ #> [CmdletBinding()] Param( [Parameter(Mandatory = $True, ParameterSetName="InterfaceName")] [String] $InterfaceName, [Parameter(Mandatory = $True)] [String] $WakeEnabled, [Parameter(Mandatory = $True, ParameterSetName="ConnectionID")] [String] $NetConnectionID ) If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!" Break } $nicsWakeEnabled = Get-CimInstance -ClassName MSPower_DeviceWakeEnable -Namespace root/wmi $nics = Get-CimInstance -ClassName Win32_NetworkAdapter | Where-Object NetEnabled -eq $true if ($InterfaceName){ $nic = $nics | Where-Object Name -eq $InterfaceName } else { $nic = $nics | Where-Object NetConnectionID -eq $NetConnectionID } $nicWakeEnabled = $nicsWakeEnabled | Where-Object InstanceName -like "*$($nic.PNPDeviceID)*" $enabled = $nicWakeEnabled.Enable if (!($enabled -and $WakeEnabled)){ Set-CimInstance $nicWakeEnabled -Property @{Enable=$enabled} } }
Find the mac address of the nic you want to wake up.Get-WmiObject win32_networkadapterconfiguration | select description, macaddress Or Get-CimInstance win32_networkadapterconfiguration | select description, macaddress To send a wake on lan package:
Install-Module -Name wakeonlan -Force Import-module -Name wakeonlan Invoke-WakeOnLan -MacAddress 84:D2:4A:0F:78:44
Anoying.
When opening Windows Explorer it opens with all folders collapsed. The behaviour can come from different settings, such as:
Showing all folders
Allowing network discovery
Last opened folder saved when closing the explorer
And probably a few I don't k now about.
Some dude (EpilepticUnderscore) over at social.technet.com created a batch file to overcome this annoyance.
See the original thread here: Collapse all folder-trees when closing Explorer (microsoft.com)
The batch job way:
I don't know if this is something that only happens in my environment, but it happens.
When ever I start AADConnect and make a change in the configuration, add an OU for example, and save the change SSO breaks.
Quick way to see what's up is here:
If there are zero Seamless single sign-on domain's than you know what's up.
The SSO trust is broken.
There is a blogpost on docs.microsoft.com about it:
Azure Active Directory Connect: Troubleshoot Seamless Single Sign-On | Microsoft Docs
The steps listed there are in this script below.
Run this from the AADConnect machine:
# https://docs.microsoft.com/en-us/azure/active-directory/hybrid/tshoot-connect-sso # Import the Seamless SSO PowerShell module cd \ cd 'C:\Program Files\Microsoft Azure Active Directory Connect' Import-Module .\AzureADSSO.psd1 # Get the list of Active Directory forests on which Seamless SSO has been enabled New-AzureADSSOAuthenticationContext Get-AzureADSSOStatus #Disable Seamless SSO for each Active Directory forest where you've set up the feature $creds = Get-Credential domain\username Disable-AzureADSSOForest -OnPremCredentials $creds # Enable Seamless SSO for each Active Directory forest Enable-AzureADSSOForest # Enable the feature on your tenant Enable-AzureADSSO -Enable $true