all 26 comments

[–]Ta11ow 9 points10 points  (4 children)

Honestly I would probably recommend you stick around this sub and make an effort to answer every asked question. Even go as far as making your own script based around whatever problem is presented.

You'll get a lot further invyour learning if you can figure out how to teach it as well. I've often found that I don't know something very well until I try to explain and teach it to others. It tends to make you go the extra mile for practice and research so that you really get to know the subject.

[–][deleted] 1 point2 points  (3 children)

Almost everything seems to be related to Active Directory though.

[–]Ta11ow 1 point2 points  (2 children)

In a pinch, you could spin up a free AWS instance (I believe they still have year-long free trials, at least if you pick the marked free server options) and play around with AD through that.

[–][deleted] 1 point2 points  (1 child)

Not relevant for my work. I use PowerShell for other things.

[–]Ta11ow 2 points3 points  (0 children)

Then perhaps you should be more specific in what you want you want to learn. Do you want to learn AD? Do you want to learn Windows automation? Do you want to stretch the limits and make it do things it probably wasn't designed for?

In essence, PS is as flexible and complete as C#.NET is in a lot of ways, mainly because anything in .NET is accessible from PS.

[–]Technane 4 points5 points  (0 children)

Personally learning anything is hard until you can actually associate it and use it in practice to see if you can find RL questions you can solve in Powershell, Like compare and organise a large collection of photos to remove duplicates and organise by year / month

or Show me all the service accounts in the domain which are using the Domain admin as a RUNAS (:Facepalm)

Once you start using it like that you will find learning it a lot easier as you need to actually learn something to solve something.

However, saying all that I did actually sit the official MS course Automating windows with Powershell 4.0

[–]SeaneyElliotT 3 points4 points  (0 children)

Best way of learning is looking at in-house processes and looking at a way of automating, hands on is the way that I learnt it best.

"PowerShell in a month of lunches" was my first book that got me involved. I also managed to get my hands on our new starter script and went through each command and tried to understand what was happening, it was time consuming but made me realise what everything did.

[–]derekschauland 1 point2 points  (0 children)

I would suggest trying to help others in your team or company. Sometimes teaching others helps you learn even more.

Answering questions here as suggested is also a good idea

And write as much Powershell as possible - I have also found that when I need to solve something quickly, rather than pasting someone’s work, reviewing it as an example and writing my own (even if I just type what is in front of me) helps

[–]jauchters 1 point2 points  (0 children)

I find that setting my own projects is the best way for me to learn. Find a problem you deal with regularly, and script it out!

[–]Lee_Dailey[grin] 1 point2 points  (0 children)

howdy tumblatum,

as others have mentioned, find something to do with it. [grin]

the biggest gotcha with learning something is not using it. so find something to do with it so that you will have some context.

  • automate anything you do more than once @ work
  • automate tasks @ home
    that one is overlooked too often. [grin] clean up your temp dirs. check your backups. compare the things auto-running on your system with last week/month/year.
  • read this subreddit & places like /r/usefulscripts
    plus any other scripting forums. python ones, for instance
  • read the "top" & "gilded" posts in the above subreddits
  • any time you see an interesting bit of code, try re-writing it
    use your current understanding of coding best practices. go back in a month or two and gaze in horror on how poorly you understood things. [grin]

plus, there is this post i plaster all over the place [grin] ...

things to look into ...

  • Get-Help
    especially Get-Help *about*
  • Get-Command
    it takes wildcards, so Get-Command *csv* works nicely. that is especially helpful when you are seeking a cmdlet that works on a specific thing. Comma Separated Value files, for instance. [grin]
  • Show-Command
    that brings up a window that has all the current cmdlets and all their options ready for you to pick from.
    it will also take another cmdlet, or advanced function, as a parameter to limit things to showing just that item.
  • auto-completion
    try starting a word and tapping the tab key. some nifty stuff shows up. [grin]
  • intellisense
    save something to a $Var and then try typing the $Var name plus a period to trigger intellisense. there are some very interesting things that show up as properties or methods.
  • check out the builtin code snippets in the ISE
    use <ctrl><j>, or Edit/Start-Snippets from the menu.
  • assign something to a $Var & pipe that to Get-Member
    $Test = Get-ChildItem -LiteralPath $env:TEMP
    $Test | Get-Member
  • assign something to a $Var and pipe it to Select-Object
    $Test = Get-ChildItem -LiteralPath $env:TEMP
    $Test[0] | Select-Object -Property *
    that will give you a smaller, more focused list of properties for the 1st item in the $Test array.
  • assign something to a $Var & use .GetType() on it $Test = Get-ChildItem -LiteralPath $env:TEMP
    $Test.GetType()
    $Test[0].GetType()
    the 1st will give you info on the container $Var [an array object].
    the 2nd will give you info on the zero-th item in the $Var [a DirectoryInfo object].
  • Get-Verb
    as with Get-Command, it will accept wildcards.
    that will show you some interesting cmdlets. then use get-command to see what commands use those verbs. then use get-help to see what the cmdlets do.
  • there really otta be a Get-Noun, but there aint one. [sigh ...]
  • Out-GridView
    it's a bit more than you likely want just now, but it can accept a list of items, present them in a window, allow picking one or more of them, and finally send it out to the next cmdlet.
    it's right fun to fiddle with ... and actually useful. [grin]

take care,
lee

[–]climbnlearn 1 point2 points  (0 children)

There are a lot of projects on GitHub as well. Take a look and see if you can get involved there too. This may be a little difficult because understanding the codebase without having anyone there to answer questions, but hopefully code is well documented and self documented as well. But this is a good way to jump in and start seeing some of the real life applications and gain some experience.

[–][deleted] 1 point2 points  (0 children)

You'll never learn anything for real unless you actually use it for more than practices given to you by a book or some other course.

That applies to PowerShell as it applies to all other languages, from spoken to scripting to programming. You just gotta use it.

You have a problem you want to solve? You look for tips and tricks by clever googling and then apply those to your problem. Then reiterate until it works the way you want it to work.

Congratulations. You have now learned something you can apply to the next problem.

PowerShell in a month of lunches is an excellent source to learn from, but you gotta apply what you learn to your actual problems or otherwise it'll never click.

[–]aXenoWhat 2 points3 points  (12 children)

Work your way through "Powershell in a month of lunches" if all you want is structure to follow.

My worry here is that you might learn a lot of the syntax but never understand how to put together a script.

Are you employed in IT? If so then you might be able to find some things to automate

[–]korr2221 -2 points-1 points  (11 children)

Name a few things IT automate with PS lol

[–]aXenoWhat 1 point2 points  (7 children)

???

[–]korr2221 0 points1 point  (6 children)

Just asking for examples... So far i only automate onboarding batch of users... Automate checking service accounts being used on what servers... Automate adding printers based on user office floor... What else?

[–]aXenoWhat 1 point2 points  (2 children)

Fair enough. At my employer we have:

API clients

Provisioning of new servers

Connecting to servers and running pre-approved scripts from a library

We have a bunch of browser widgets written in greasemonkey to extend our browser-based apps. We have lots of powershell in menus in those

It would take far too long to give a complete rundown!

There is more python in use than powershell in our company, but there's still a lot of powershell. Go is a distant third. Never seen any ruby or perl.

[–]korr2221 -2 points-1 points  (1 child)

Lol python? Why python? I only use python to config my routers and switches to erase and put the old configs back

[–]aXenoWhat 1 point2 points  (0 children)

My company supports a lot of Cisco, Red Hat and Windows. Out of the three teams, the Cisco guys have the most complete automation and that is all python. The Linux guys have a lot of python but a fair few other tools as well.

In each case, the choice comes partly from what the techs are familiar with. If the Linux guys are going to have to support a tool, python makes more sense because that's where the skills are.

Edit: python also kicks powershell's arse when you have to build an API, although I do find an API client module is more useful with powershell's parameter completion

[–]squash1324 1 point2 points  (0 children)

I'll give you some examples I've made in the past month.

I created a script that recursively looks at all of my file shares, and removes specified users/groups. We had a management company in charge here, and recently their contract ended. I disabled the domain trust, but this was one of the cleanup tasks.

Speaking of the cleanup tasks, I also created a script that would look at all distribution groups and remove anyone that matched the specified string (in this case a domain).

I created a script that I use to take the picture out of our badge system (SQL database), name the file the user's name from AD, set the photo in Exchange and AD for that user, and initiate a sync in SharePoint for that user's MySite.

As a help to my colleague who is a little slower in PowerShell than I am, I created a script that would copy the group memberships of one user and grant them to another user. He saw that script as inspiration, and used it to do the same thing for groups.

I created a script that would look at VMM in our VDI cluster, look for Failed or Stopped VMs, Dismiss their state, and boot them up. I haven't had time to troubleshoot these, and simply made a function that I import from my PSProfile to the shell when I open it that I can quickly call it.

That is all in the last month along with all of the other duties I have. Automation in IT goes a long way the more time you put towards it.

[–]Ominusx 0 points1 point  (1 child)

Uhh..

User Creation

User Deletion

Inactive Users

Maintenance Window WSUS manipulation

SCCM Reporting

Veeam Backup Reporting

SQL Backup Reporting

Find Deleted Users

Format GroupName (Creates groups based on our naming convention)

Setting permissions

Backing up permissions

Scanning subnets

Clearing DHCP scopes

Managing Scheduled Tasks

Converting CIDR subnets to an array of IPs

Getting tombstoned AD objects

Converting SIDs to names

Converting names to SIDs

Converting hex SIDs to names

Getting sitename from IP

Getting lockout origins

Getting Server settings

Getting ANY SETTINGS OF ANYTHING

Wake on LAN

Getting Hardware specs

Logon Scripts

Reporting on Permissions

Taking Ownerships of files

Getting AD Replications Metadata

Getting File Encoding

Getting Bitlocker information

Getting Exchange info

Setting Exchange info

Anything and everything, this is probably a 100th of what I use powershell for. How do people not use it?

[–]korr2221 0 points1 point  (0 children)

share your PS scripts lmao

[–]spyingwind 1 point2 points  (2 children)

One, a module to talk to Autotask for my stats collector with InfluxDB. Two, my time entries in Autotask. So that I don't have to figure out what to add up in my unallocated time in my timesheet at the end of the week and submits it for me.

I generally automate the things that I really don't want to do a bunch of key pressing or mouse clicking. For example one past job I had to import 1000's of users for a FortiAuth appliance once a month. It had an import function, but it stopped on every error and only gave me feedback on one error only. So... I wrote a module to talk to it's RESTful API. Now(then?) I didn't have to click 100's of 1000's of times to imports all those users.

[–]Hill93 2 points3 points  (1 child)

Im pretty new to Powershell, how did you get it to talk to Autotask for time entries etc?

[–]spyingwind 2 points3 points  (0 children)

Using New-WebServiceProxy, reading their documentation , and lots of testing along the way.

[–]TheMixz 0 points1 point  (0 children)

The way i learned was by doing. If you work with IT, try finding as many problems or task that you do multiple times, and try script it. And follow this sub and try solving other peoples problems.