PowerShell for Windows Admins


October 29, 2013  3:29 PM

A new lunches book

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Manning have started the early access program (MEAP) for Learn SCCM 2012 in a Month of Lunches – http://www.manning.com/bannan

SCCM is a major component for managing your environment. Looking forward to reading it – especially as it has a chapter devoted to PowerShell

October 28, 2013  3:09 PM

Powershell help file updates

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

The updated PowerShell help files are available for all but a handful of modules – the outstanding ones should be available this week.

Time to run update-help


October 28, 2013  2:00 PM

Outputting collections from AD

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Have you ever tried anything like this:

Get-ADUser -Filter * -Properties * |
Select Name, LastLogondate, PasswordNeverExpires, Enabled,
@{N=’OU'; E={($($_.distinguishedName) -split “,”,2)[1] }},
Memberof |
Export-csv -Path users.csv -NoTypeInformation

You want some basic information about the users plus their group membership

What you get is this

Name : Fred Friday
LastLogondate :
PasswordNeverExpires : False
Enabled : True
OU : OU=Mailboxes,DC=Manticore,DC=org
Memberof : Microsoft.ActiveDirectory.Management.ADPropertyValueCollection

The data is OK apart from the group membership where you get the name of the object.

All you need is a little trick with sub expressions

Get-ADUser -Filter * -Properties * |
Select Name, LastLogondate, PasswordNeverExpires, Enabled,
@{N=’OU'; E={($($_.distinguishedName) -split “,”,2)[1] }},
@{N=’Groups'; E={$($_.Memberof)}} |
Export-csv -Path users.csv –NoTypeInformation

and then the data comes through

Name : Fred Friday
LastLogondate :
PasswordNeverExpires : False
Enabled : True
OU : OU=Mailboxes,DC=Manticore,DC=org
Groups : CN=Wednesdaylist,OU=DistributionGroups,DC=Manticore,DC=org

Enjoy


October 28, 2013  1:36 PM

Setting AD attributes from a CSV file

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Back in this post http://richardspowershellblog.wordpress.com/2012/02/29/setting-a-users-home-directory/ I looked at setting the users home directory. I recently got a question about using a CSV file for input.

CSV files have been around for years and are likely to be with us for a long time to come – its a very useful and compact format. using a CSV file to set attributes is a two stage process – read the data then make the changes.

I’ll use the home directory data as an example. If you have a csv file with an entry for every user looking like this:

samaccountname : sjones
Drive : H:
Home : \\server2\Home\sjones

You can then do this:

Import-Csv .\homes.csv |
foreach {
Set-ADUser -Identity $_.samaccountname -HomeDirectory $_.Home -HomeDrive $_.Drive -PassThru
}

If the attribute doesn’t have a parameter then:

Import-Csv .\homes.csv |
foreach {
Set-ADUser -Identity $_.samaccountname -Replace @{HomeDirectory = “$($_.Home)”; HomeDrive = “$($_.Drive)”} -PassThru
}


October 27, 2013  11:09 AM

WMF 4.0 now available

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

You’ve probably seen this already but just in case – Windows Management Framework 4.0 is now available to download. It includes PowerShell 4.0 and Desired State Configuration plus updates to PowerShell Web Access. WinRm is also part of the package.

Versions are available for:

Windows 2012

Windows 7 SP1

Windows 2008 R2 SP1

Windows 7 Embedded

There isn’t a version for Windows 8 – it comes as part of the Windows 8.1 upgrade

Windows 8.8 and Server 2012 R2 come with WMF 4.0 pre-installed.

You need .NET 4.5 installed before installing WMF 4.0


October 27, 2013  10:48 AM

More Scripting Guy posts

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I’ve had some more articles posted on the Scripting Guy blog

http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/27/the-admin-s-first-steps-local-group-membership.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/20/powertip-find-members-of-critical-groups-with-powershell.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/20/the-admin-s-first-steps-empty-groups.aspx

Enjoy


October 14, 2013  2:22 AM

Sunday’s Scripting Guy blog

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I had another post in my Admin’s First Steps series on the Scripting Guy blog yesterday –

http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/13/powertip-use-poweshell-to-start-service-on-remote-machine.aspx
http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/13/the-admin-s-first-steps-discovering-shares.aspx

Enjoy


October 11, 2013  11:48 AM

Summit 2014 Speaker list “leak”

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Possible speakers at the PowerShell Summit in April 2014.

http://powershell.org/wp/2013/10/10/leak-powershell-summit-na-2014-speakers/

If you want to see, hear and talk to these PowerShell experts – the PowerShell summit is unlike most other conferences as the speakers are available

Now is the time to register – http://powershell.org/wp/community-events/summit/powershell-summit-north-america/summit-registration/

Some places will be reserved for the New Year for late bookings but I don’t think there’ll be many. We sold out last year & had a brilliant 3 days. This is going to be better


October 10, 2013  1:33 PM

Testing Service Health

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Two new posts from me on the Scripting Guy blog

http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/10/powertip-change-output-object-property-names-with-powershell.aspx

http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/10/the-admin-s-first-steps-testing-service-health.aspx

Enjoy


October 9, 2013  2:05 PM

AD Management MEAP v 11

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

The next MEAP for AD Management in a Month of Lunches is available from Manning – www.manning.com/siddaway3

This adds chapter 20 on maintaining and monitoring AD together with appendix A on searching AD

Enjoy


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: