Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Change a User’s Primary Group?

Hey, Scripting Guy! How can I change a user’s primary group?-- AS Hey, AS. You know, one of the Scripting Guys knows how to make an incredibly rich rocky road brownie, a brownie that’s topped with melted marshmallows and walnuts and chunks of dark chocolate and all sorts of other good stuff. Now, some people might ask whether or not, in...

How Can I Increment the Last Line in a Text File?

Hey, Scripting Guy! How can I increment the last line in a text file; that is, if the last line is 1, indicating we’ve done one backup, I need to increment it to 2, indicating that we’ve now done a second backup.-- TH Hey, TH. If you’ve ever been to a carnival then you’ve no doubt been tempted by some of the sideshow games. Throw a ...

How Can I Get a List of All the Users Whose Passwords Never Expire?

Hey, Scripting Guy! How can I get a list of all the users whose passwords never expire?-- NW Hey, NW. As you probably know, Internet gambling is illegal in the USA. That’s too bad, because if it wasn’t we’d be willing to bet $10 that the answer to your question will be this: search Active Directory. And as much as we hate to say “We...

How Can I Determine the 20 Largest Files on a Computer?

Hey, Scripting Guy! How can I determine the 20 largest files on a computer?-- PW Hey, PW. Having recently returned from a vacation in Europe, the Scripting Guy who writes this column now understands that there are different ways to do things. Some of these would be difficult to adjust to on a regular basis: for example, ordering a soft ...

Feedback usabilla icon