PoshCode Archive  Artifact Content

Artifact e55334201accb027e6e7bd20f18c45de4528551725808378266f9251cff1f994:

  • File getmacs.ps1 — part of check-in [cbd8a8d482] at 2018-06-10 13:47:41 on branch trunk — Basic script that gets mac addresses (NetBIOS table) from a list of remote hosts. (user: Qodosh size: 1300)

# encoding: ascii
# api: powershell
# title: getmacs.ps1
# description: Basic script that gets mac addresses (NetBIOS table) from a list of remote hosts.
# version: 1.1
# type: script
# author: Qodosh
# license: CC0
# x-poshcode-id: 4903
# x-archived: 2017-05-22T01:32:28
# x-published: 2014-02-16T05:10:00
#
#
###############################################################################################################################
# Script: getmacs.ps1
# Description: Very basic script that gets mac addresses (NetBIOS table) from a list of remote hosts.
# Qodosh
# Date: 2.14.2014 
# Version: 1.1
# Usage: 
# 1. Make a text file with a list of hosts names that you want to get mac addresses from. 
# 2. Edit $strservers in-between the quotes and enter the path to your list. 
# 3. Edit $log in-between the quotes. Put the location you want to make the log file. 
#
# Location of the servers you want to grab a NetBIOS table from
$Servers = Get-Content 'C:\servers.txt'
# Location of the log file. Feel free to change.
$log = 'c:\log.txt'
# Loops through each server performing a simple nbtstat command and pipes output to log variable. 
foreach ($Server in $Servers)
{
    nbtstat -a $Server >> $log
} 
# Opens log file once operation completes
start $log