Category: Microsoft Windows PowerShell

Amazon Web Services – AWS CLI Command Reference

You may use this link to access the documentation for the AWS CLI Command Reference. Additionally, according to the official AWS documentation “The AWS Command Line Interface is a unified tool that provides a consistent interface for interacting with all parts of AWS.”


Amazon Web Services – Configure Password Policy with AWS CLI

You may use the following command from the AWS Command Line Interface to configure the account password policy. This is an example configure and more information may be found here.

aws iam update-account-password-policy –minimum-password-length 8 –require-uppercase-characters –require-lowercase-characters –require-numbers –no-require-symbols –max-password-age 60 –hard-expiry –allow-users-to-change-password –password-reuse-prevention 24


Microsoft Windows Command Prompt – Configure Network Settings

You may use the following commands from the Windows command prompt to configure the IP address and DNS server of a server running Microsoft Windows Server 2016 Standard. You will need to modify the name of the network interface card, IP address, subnet mask, default gateway, and DNS server.

netsh
interface ip set address name=”ethernet” static 10.0.25.100 255.255.255.0 10.0.25.1
interface ip set dns “ethernet” static 10.0.50.100
interface ip show config
exit

Lastly, more information may be found here.


Integrated Dell Remote Access Controller 8 – Get IP Address

Have you ever connected to a remote server but didn’t know what it’s Integrated Dell Remote Access Controller 8 (iDRAC8) Internet Protocol (IP) address was?

Well, you may use the following command to get the IP address of an iDRAC8.

racadm getniccfg

Additionally, more information may be found here.


Microsoft Hyper-V – View All Virtual Machines in a Failover Cluster

You may use the following Microsoft Windows PowerShell cmdlet to view all of the virtual machines in a Microsoft Windows Hyper-V Failover Cluster. In order for this cmdlet to provide the list of virtual machines it will need to be run from a Hyper-V host in the cluster.

Get-ClusterGroup | ? {$_.GroupType -eq ‘VirtualMachine’ } | Get-VM


Microsoft Office 365 – Export Group Members

You may use the following commands to connect to Microsoft Office 365 from Windows PowerShell then export the members of a group to a file of your choice.

Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
Get-UnifiedGroup -Identity “<<<INSERT_GROUP_NAME>>>” | Get-UnifiedGroupLinks -LinkType Member | Out-File -Filepath “<<<INSERT_FILE_PATH>>>”
Remove-PSSession $Session


Microsoft Active Directory – Add-Computer Cmdlet

You may use the following Windows PowerShell cmdlet to add a host to a Microsoft Active Directory domain with a specific domain controller. You will need to substitute the DOMAIN parameter with the actual domain name.

Add-Computer -DomainName DOMAIN -Server DOMAIN\DC01


Microsoft Active Directory – Trust Relationship Failure with Primary Domain

If you’ve worked with Microsoft Active Directory, then it’s very likely you’ve seen the following error message while trying to login to a server or workstation using domain credentials: “The trust relationship between this workstation and the primary domain failed.”

Typically, this is resolved by removing the server or workstation from the domain then rejoining it to the domain. However, the Reset-ComputerMachinePassword cmdlet may be used to change the computer account password that the computer uses to authenticate to domain controllers in the domain. For example, you may use the following syntax: Reset-ComputerMachinePassword -Server DC01 -Credential DOMAIN\– USER. As this is an example, you’ll need to substitute the DC01 field with a domain controller in your Microsoft Active Directory domain. Additionally, you’ll need to substitute the DOMAIN\– USER field with the domain and username of a user in your Microsoft Active Directory domain.

I believe this solution is preferable due to the fact that the Microsoft Active Directory computer object continues to use the same SID, remains in the appropriate OU, and remains in any necessary groups.

More information on this cmdlet may be found here.


Amazon Web Services – Verify AWS CLI Installation

You may use the following link to receive instructions on installing the AWS CLI. Additionally, to verify the installation, navigate to C:\Program Files\Amazon\AWSCLI for x64 operating systems and C:\Program Files (x86)\Amazon\AWSCLI for x86 operating systems.

Lastly, you may verify the version of the AWS CLI using the aws –version command from a Windows Command Prompt or Windows PowerShell session.


Microsoft Windows Server 2016 – Delete Recycle Bin Items

You may use the command below from the Microsoft Windows command prompt to delete the objects in the recycle bin for all users on Microsoft Windows Server 2016.

rd /s /q c:\$Recycle.Bin