Category: Microsoft Windows PowerShell

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…

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…

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

Microsoft Windows PowerShell – Get DHCP IPv4 Scope Details

The Windows PowerShell cmdlet below will query a remote Dynamic Host Configuration Protocol (DHCP) server and provide the lease duration of each IPv4 scope. Get-DhcpServerv4Scope -ComputerName HOSTNAME | Select ScopeID, LeaseDuration

Microsoft Active Directory – Computer Object Password

You may use the following Windows PowerShell cmdlets to view the last time an Active Directory (AD) computer object reset it’s password for all of the computer objects in an AD domain or an individual computer object in an AD domain. Get-ADComputer -Filter * -Properties PasswordLastSet | Select Name, PasswordLastSet | Sort-Object Name, PasswordLastSet |…

Microsoft Windows PowerShell – View Reboot and Uptime

The Microsoft Windows PowerShell script below will query a Windows hosts for the time it was rebooted and the time it completed it’s reboot. <#.SYNOPSISThis script will request the hostname of a server then provide the time it was shutdown and completed it’s reboot..DESCRIPTIONThis script will request the hostname of a server then provide the…

Microsoft Windows PowerShell – Get Host Architecture

You may use the following Microsoft Windows PowerShell script below to get the architecture, physical or virtual, of a Windows host on a network. <#.SYNOPSISThis script will provide the architure (physical of virtual) of a host..DESCRIPTIONThis script will provide the architure (physical of virtual) of a host..EXAMPLEsysteminfo /s $HOSTNAME | findstr /c:”Model:” /c:”Host Name”.AUTHORWritten by…

VMware PowerCLI – Power On a Virtual Machine

You may use the VMware PowerCLI cmdlet below to power on a VMware virtual machine. Start-VM -VM SERVER

VMware PowerCLI – Create a Snapshot

You may use the following VMware PowerCLI cmdlet to create a snapshot of a virtual machine (VM) in VMware. New-Snapshot -VM HOSTNAME -Name “<<>>” -Description “<<>>”