August 22

How to use Powershell to Export All Distribution Groups and Members to CSV

Create a temp fold at c:\ called c:\temp and run the following script


$Groups = Get-DistributionGroup
$Groups | ForEach-Object {
$group = $_.Name
$members = ''
Get-DistributionGroupMember $group | ForEach-Object {
        If($members) {
              $members=$members + ";" + $_.Name
           } Else {
              $members=$_.Name
           }
  }
New-Object -TypeName PSObject -Property @{
      GroupName = $group
      Members = $members
     }
} | Export-CSV "C:\temp\Distribution-Group-and-Members.csv" -NoTypeInformation -Encoding UTF8
July 12

How to find AD users Password Expiration Date and find all users with password never expires

Find AD users Password Expiration Date

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties DisplayName, msDS-UserPasswordExpiryTimeComputed | Select-Object -Property Displayname,@{Name=”Expiration Date”;Expression={[datetime]::FromFileTime($_.”msDS-UserPasswordExpiryTimeComputed”)}}

Find all users with password never expires

get-aduser -filter * -properties Name, PasswordNeverExpires | where { $_.passwordNeverExpires -eq “true” } | where {$_.enabled -eq “true”}| Format-Table -Property Name, PasswordNeverExpires -AutoSize

January 4

How to find out what switchport a device is connected to in Cisco switch

Problem:

trying to find out which switch port a computer is connected to, the wall jack doesn’t have a label to tell the switchport.

Solutions:

Step 1 use command  terminal monitor

Step 2 disconnect/reconnect the computer from the network

The output shows the computer is connected to interface g1/0/44

Disconnection:

Mar 9 20:46:53.580 SV: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/44, changed state to down

Mar 9 20:46:54.594 SV: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/44, changed state to down

Connection:

Mar 9 20:47:02.311 SV: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/44, changed state to up
Mar 9 20:47:03.311 SV: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/44, changed state to up

Category: Cisco | LEAVE A COMMENT
January 1

How to locate a device using mac address in Cisco switch

  • log into Cisco switch Ping device’s IP address first and

  • find the mac address using show arp | include 99  (note: use include to filter the output)

  • use show mac address-table | include 8cce (note: use part of the mac address to filter the result)

  • Here, we know that the device is connect to port 9

Note: if the one switch is connected to another switch, we can use show cdp neighbors  and show cdp neighbors deail to find out the ip address of the connected switch  .

Category: Cisco | LEAVE A COMMENT