Month: June 2011

PowerShell–AD Module

Searching AD for a specific attribute using the get-aduser function from the ActiveDirectory PowerShell module. First the ActiveDirectory module needs to be loaded.  You can check to see if the module is available by typing: Get-Module -listavailable If you don’t see the ActiveDirectory module you will need to download the RSAT.  To load the module […]

PowerShell–Get ACL with a readable path

When you want to run the Get-Acl cmdlet against a directory, the path property in the results is a bit messy.  Example: Get-Childitem C:\Labs -recurse | Get-Acl | Format List Path, Owner, Access We can clean up the Path property by using a custom label with a substring Get-Childitem C:\Labs -recurse | Get-Acl | Format […]

Powershell–Comparing processes

This week I am teaching a PowerShell v2.0 class at Benchmark Learning.  During the class I usually show the following demo. # Get the current running processes $Baseline = Get-Process # Create some new processes Calc Notepad # Capture the current running processes $Now = Get-Process # Compare the two variables Compare-Object $Baseline $Now The […]

Using PowerShell to get Share and NTFS permissions

I am teaching a class this week at Benchmark Learning and had a great student question. “How do I get share permissions AND NTFS permissions” Well, look no further. The Get-SharePermission function was found here: function Get-SharePermission { Param($Server = $env:COMPUTERNAME) $ShareSecurity = Get-WmiObject win32_LogicalShareSecuritySetting -ComputerName $Server foreach($Share in $ShareSecurity) { $sharenames = $Share.Name […]