It has been a few weeks since my last post and i feel obliged to blog
something today. so i think the Active Directory module is worth mining. today a
simple PowerShell script to list User membership in the AD.
since the AD cmdlets are very extensive it took me a little while to find out
how to get group memberships out of the AD. This little script will show the
membership of a user from a AD group and it will save it into a Excel
workbook.
Import-Module ActiveDirectory
$a = New-Object -ComObject
excel.application
$a.visible = $true
$b = $a.workbooks.add()
$C =
$b.ActiveSheet
$c.Cells.Item(1,1) = "Login ID"
$c.Cells.Item(1,2) = "Member Off"
$i =
2
$group = "Enterprise Admins","Domain Admins"
foreach ($grp in $group)
{$users = Get-ADGroupMember $grp
foreach($_ in $users){
$c.cells.item($i,1) =
$_.SamAccountName;$c.cells.item($i,2) = $grp;$i=$i+1
}
}
$b.SaveAs("C:\Powershell\Adminsreport\Admins.xls")
$a.quit()
Labels
Powershell
(18)
MDT
(9)
Active Directory
(7)
MDT 2012
(5)
Microsoft Deployment Toolkit
(5)
PSexec
(5)
Primal Forms
(4)
Wake on LAN
(4)
Zerotouch deployment without SCCM
(4)
MDT Database Object Property
(3)
MDTDB powershell module
(3)
MDX
(3)
Michael Niehaus MDTDB module
(3)
PXE
(3)
MDT Property values
(2)
PowerShell array
(2)
Start LiteTouch deployment remote
(2)
System Center Config Manager 2012
(2)
Use PowerShell to start MDTdeployment remote
(2)
WOL
(2)
Cluster network name resource 'Cluster Name' failed registration of one or more associated DNS name(s) for the following reason
(1)
EventID 1196
(1)
Hyper-V 2012
(1)
Microsoft-Windows-Failover-clustering
(1)
W32Time
(1)
Windows time
(1)
custom drive configuration in MDT
(1)
failover cluster
(1)
time synchronization in AD
(1)
understanding MDT deployments. LiteTouch deplyment
(1)
use PowerShell to wake up machine
(1)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment