Generate SSH Key in Windows

Starting from Windows 10 build 1809, Windows has a native SSH client that is based on the OpenSSH port.

The OpenSSH client in Windows includes an ssh-keygen – the command-line tool for creating authentication keys for SSH.

To create a pair of SSH keys in Windows, the ssh-keygen command can be executed from a Windows command-line prompt (CMD) or PowerShell.

This note shows how to generate SSH keys in Windows using the ssh-keygen command. (more…)

Bad owner or permissions on ‘.ssh/config’ [SOLVED]

Starting from Windows 10 build 1809, Windows has a native SSH client that is based on the OpenSSH port.

If you try to connect to some host from a Windows command-line prompt (CMD) or PowerShell using the ssh command, you may receive the error as follows:

Bad owner or permissions on C:\\Users\\<username>/.ssh/config

This short note shows how to fix the permissions on all the files under the C:\\Users\\<username>/.ssh folder. (more…)

What Active Directory Groups Am I In?

If your computer is running in a corporate environment, one day you may wonder which Active Directory (AD) groups your current user is a member of.

The easiest way to see what AD groups i am a member of is by executing the appropriate commands from a command prompt (CMD or PowerShell) and this short note shows how to do this. (more…)

Windows: `lsusb` Equivalent – PowerShell

The lsusb command in Linux, known as the “List USB” command, is widely used to list the connected USB devices and display the information about them.

One of the quickest ways to list the connected USB devices in Windows is by using the “Device Manger”: simply press the ⊞ Win key to open the “Start Menu” and type “device manager” to search for the app.

You can also open the “Device Manager” through the “Run” dialog, by pressing the ⊞ Win + R and executing the devmgmt.msc command.

Although there is no direct equivalent to the lsusb command in Windows, you can use the PowerShell’s Get-PnpDevice command to list the connected USB devices and display the information about them. (more…)

Get Members of AD Group in PowerShell

Get-ADGroupMember command in a Windows PowerShell is used to get the members of an Active Directory (AD) group.

To able to get the AD group members using the ADGroupMember command you need to have an “Active Directory Users and Computers” tool installed and you should be logged into a domain-joined computer as an Active Directory user with the relevant permission.

In this note i will show how to get the AD group members using the ADGroupMember command from the PowerShell.

Cool Tip: How to get Active Directory groups using PowerShell! Read more →

Get Members of AD Group in PowerShell

To get the members of an AD group in the domain the computer is connected to, use the PowerShell’s Get-ADGroupMember command as follows:

PS C:\> Get-ADGroupMember -Identity "<groupName>"

If the AD group which members you need to get is in another domain, add the Server parameter:

PS C:\> Get-ADGroupMember -Identity "<groupName>" -Server <domain>

To get the sorted list of the AD group member names only:

PS C:\> Get-ADGroupMember -Identity "<groupName>" | Select Name | Sort Name

To extract the every member of the “nested” AD group (when another groups are among the group members), add the Recursive attribute:

PS C:\> Get-ADGroupMember -Identity "<groupName>" -Recursive | Select Name | Sort Name

If you are getting an error as follows while trying to execute the commands above, you need to install the Active Directory Users and Computers on your computer:

Get-ADGroupMember : The term ‘Get-ADGroupMember’ 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.

Cool Tip: Find out what domain controller am i connected to! Read more →

Get Active Directory Groups – PowerShell

Get-ADGroup command in a Windows PowerShell is used to query a Domain Controller and return Active Directory group objects.

Particularly it can be used to get a list of all the Active Directory groups in the Domain Controller the computer is connected to.

To get the Active Directory groups using the Get-ADGroup command you need to have an “Active Directory Users and Computers” tool installed and you should be logged into a domain-joined computer as an Active Directory user with the relevant permission.

In this note i will show how to get the Active Directory groups using the Get-ADGroup command from the PowerShell.

Cool Tip: Find out what domain controller am i connected to! Read more →

Get Active Directory Groups

To get all the Active Directory groups in the domain the computer is connected to, use the PowerShell’s Get-ADGroup command as follows:

PS C:\> Get-ADGroup -Filter *

To get the Active Directory groups in another domain, add the Server parameter:

PS C:\> Get-ADGroup -Filter * -Server <domain>

To get the sorted list of the Active Directory group names only:

PS C:\> Get-ADGroup -Filter * | Select Name | Sort Name

Use the following construction to search for the Active Directory groups using the PowerShell’s grep equivalent, e.g. to get the Active Directory group names starting with “Adm“):

PS C:\> Get-ADGroup -Filter * | Select Name | Out-String -Stream | Select-String "^Adm.*"

To find a single group, use the Identity parameter, e.g. to check if an Active Directory group called ‘Administrators‘ exists, run the command below:

PS C:\> Get-ADGroup -Identity 'Administrators'

If you are getting an error as follows while trying to execute the commands above, you need to install the Active Directory Users and Computers on your computer:

Get-ADGroup : The term ‘Get-ADGroup’ 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.

Cool Tip: How to get the members of an AD group in PowerShell! Read more →