All you need to start
The book "Learn PowerShell in a month of lunches" is a great first read!
This is how I learned the basics. My boss gave this to me within my first few months of working IT. He saw some potential and I took it and ran. Seriously, just do one module a day and learn it well.
It's cliche, but Month of Lunches is great if you're looking for a book. Honestly my advice is to solve problems with powershell. Learn to lean heavily on "Get-Command" and "Get-Help". When someone comes to you with something you would normally use the gui for, just figure out how to powershell it (advice - avoid device drivers)
A key piece of Systems Administration is driving yourself. In many situations you are the bottleneck to other people accomplishing their project or to fixing an issue - this means you need to understand that everyone is going to tell you their thing is high priority because they can't do anything til you're done. As you grow, you'll figure out how to get out of that position (automating pieces is a major part of that) but right now, focus on communicating clearly and honestly. Learn to set expectations - that's more important then any technical skill you can focus on.
Learn Windows PowerShell in a Month of Lunches 3rd Edition
Learn Python 3 the Hard Way
Automate the Boring Stuff with Python
The Python Tutorial
A Gentle Introduction to Programming Using Python
More at http://Learn.SharjeelSayed.com
"how can I learn to script powershell without having the basics for syntaxes"
honestly, i think if you try going this route, you're going to wind up very frustrated. you really ought to start with the basics. you can't just jump straight to the "knowing" part -- have to go through the process of learning before you get there. crawl before you can walk, and all that.
i bought myself a copy of "Learn Powershell in a Month of Lunches" (amazon link: https://www.amazon.com/Learn-Windows-PowerShell-Month-Lunches/dp/1617294160/) and i like it. many people here on /r/sysadmin recommend it, as well. i would start there to build a good foundation. one of the earliest things the book teaches you is how to use powershell's built-in help and how to read error messages and such, which will become extremely helpful when you do get to the point where you start writing scripts.
buy that book, and/or ask your supervisor to buy you a license to a training site like CBT Nuggets or PluralSight. some people prefer videos and narration over books, but find what works for you, and remember to start with the basics and move up from there.
The best way to learn anything depends on your learning style. Some people learn better by reading, some by watching videos, and some by doing. It's important to know how you learn effectively.
That said, my recommendation is to find a routine task you do regularly and figure out how to do it automatically with PowerShell. Do you archive old report files to a specific directory structure? Learn about Copy-Item. Do you manage Exchange, SCCM, O365, anything like that? They all have automation support with PowerShell. There are even community modules that support a lot of third-party products - for example, the JiraPS project allows you to manage JIRA items with PowerShell, including creating new issues, commenting on existing ones, and closing them out.
If you prefer reading, the book Learn PowerShell in a Month of Lunches is often recommended - but it's very important that you actually follow along with the exercises in the book. Type them and run them on a live computer whenever possible.
If you prefer videos, I suggest the Microsoft Virtual Academy series on PowerShell. These are a bit long, but they do a great job of teaching you both concepts and practical knowledge.
Hope that helps!
First let me say I agree stack is not a code generation site. It goes a long way if you have a little bit of code to show as to what you have tried. Even if it is TERRIBLE others in the community will feel compassion and empathy towards you versus negativity. Second please go to amazon and buy the book "Learn Powershell in a Month of Lunches" This will help you a ton and get your fundamentals down. Real easy read.
Ok now off my soapbox. So I have created a csv called updatetelphones.csv and placed it in my C:\temp folder on my desktop. It has two columns one called SamAccountName and a second Called TelephoneNumber. Notice no spaces. With powershell we want to import that into a variable then iterate through each item and set the phone number for the user.
$UsersToUpdate = import-csv -Path "C:\temp\updatetelephones.csv"
foreach($User in $UsersToUpdate)
Set-ADUser -Identity $User.SamAccountName -OfficePhone $User.TelephoneNumber -WhatIf
Above is the powershell code. Now look carefully at the end of my set-aduser command I have a -whatif. ANYTIME you are making changes to AD I recommend you test your script with the -whatif first. That simulates the changes but doesn't make any so you can confirm it is accurate. So use this to test on your side. Once you validate remove the "-whatif" and run to actually make the changes. Peace and Happy powershell learning!!
Powershell in a Month of Lunches: https://toptalkedbooks.com/amzn/1617294160
Learn Powershell Toolmaking in a Month of Lunches: https://toptalkedbooks.com/amzn/1617291161
I'd recommend those to someone new to PoSH. :)
Many people (myself included) would recommend getting:
If you have any interest for getting into powershell. It's a great resource.