Link to home
Start Free TrialLog in
Avatar of CuriousMAUser
CuriousMAUser

asked on

Within PowerShell 4.0 I'd like to export the servers network mappings and the assigned group permissions.

Hello,

Within PowerShell 4.0 I'd like to export the servers network mappings and determine the assigned group permissions. The first part is the drive mappings and afterward I'll tackle the permissions. I'd like to reference servers.txt to find the servers and export all drive mapping details. Any thoughts?

=======================================================================
#
# NAME: Get-MappedDrives.ps1
#
# Modified: Medical Inc IT Staff
# Date: 17-Mar-2015
# Verison: PowerShell 4.0
# Client OS: Windows 7
# Server OS: Windows 2008 R2
#
# Description: Retrieve Workstations Drive Mappings
#
# To run the script
#
# .\Get-MappedDrives.ps1
#
#
##############################################################
$computerlist = "Get-Content C:\Scripts\Servers.txt"
$namespace = "root\CIMV2"

ForEach ($computer in $computerlist)
{
$Result1 = Get-wmiobject Win32_ComputerSystem -computer $computer | select username
$Result2 = Get-WmiObject -class Win32_NetworkConnection -computername $computer -namespace $namespace |  select logicaldisk
      $Result += $Result1, $Result2 | %{Add-Content "C:\Scripts\$computer.txt" $_}
}
ASKER CERTIFIED SOLUTION
Avatar of Tony Massa
Tony Massa
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CuriousMAUser
CuriousMAUser

ASKER

Thank you, a helpful link.