Great video! Just wanted to add, get-date $pig -UFormat %y This actually returns the year, it returned 17 in the case as it was 2017 at the time. %V returns the week number, the 'v' didn't work in your video because it needs to be upper case.
Shane Young.. you made my learing easier ...I started learning PowerShell by watching your video tutorial. Thanks for the clear and informative content.
Congratulations, I'm starting with Powershell and you have the best videos and explanations I have seen about Powershell, you gave me a new approach. Good job. Thanks man!!
Hey Shane, as i was confused whether to opt to learn powershell or not as most of my friends has confused me that its really tough to learn after watching your series of videos i came to know its not tough, hats off to you as u made it so clear and easy to understand
Hey man... You are rocking with you videos. Great way of explanation, most important you give full justification to every topic that you have touched. So with word topic :) Can you make a video with regx explanation (Or Point me if you have already). Thanks in Advance
Hi Shane, When I use the get-date command I get: August 25, 2023 11:11:23 AM Everywhere I have searched shows the default output to be Friday August 25, 2023 11:11:23 AM What do I have to do to change the format? I used get-date -uformat %c but it does not change it. Take care,
Hi there, very simple one. How do you create a batch file to launch powershell in administrator mode without having to press "ok" buttons and to then set some simple environmental variables?
Hi Shane, thanks for sharing in a very interesting way. At 16:45 into the video I noticed something peculiar. Could you perhaps explain how subtracting 9 months from 11 December 2016 gives 12 July 2016? I would think it to be around 11 or 12 March 2016. Kind regards
Thys I looked through the video and didn't see the part you are talking about? Can you double check your time stamp again? Thanks. Happy to clear up any confusion.
Okay I kept watching and found the confusion. It is around 15:25. You confusion comes from we are setting the value of Zebra.CreationTime = $pig.addmonths(-9). $pig was April 11 so we are subtracting 9 months from that date. The December date was the old value of CreationTime and not part of the math. Does that help?
Hey, great set of videos, sparked an interest for Powershell... But I wonder, how come your text changes color depending on the type of input you write, while mine is always the same color? :L
Awesome video Shane! Thank you so much for your great effort. I would like to ask that i got some difference in time format in my output. I have windows10 OS. Below is the example--- PS C:\Users\Ankit Singh> Get-Date 15 September 2017 11:04:19 Here Day is not present.
Hey Shane New to PS but quickly learning. Mostly thanks to your tutorials. I have written Create New AD User from CSV file script. The csv has a date presented as dd/MM/yyyyy, However Powershell pukes at that format and wants it presented as MM/dd/yyyy. I note i see a post about converting/changing the "culture" but it seems really complicated for just changing the format of the dta as presented. All other examples i find regarding manipulating DateTime is when using the Get-Date command. Since i already have the date, i am struggling. Do you or anyone have a quick and easy method to change the format of the date given to me by another department? Thanks for all your videos - Cheers Happy New Year 2021 Mr Weeble
@@ShanesCows Thanks for the response Shane. I need to test, but i believe i have found the solution. $ProperDateFormat = [datetime]::parseexact($expire, 'dd/MM/yyyy', $null).ToString('MM/dd/yyyy')
The tutorial is very well done! One annoyance: after every "cls" that you do, if you are in full screen mode, the video title appears whenever you touch the mouse and obscures the stuff you're typing. If not in full screen mode, the text is too tiny to read! Seems like the easiest solution is to simply stop using cls. Other than that, I was properly educated!
I know this video is old, just wanted to say thank you. Also could you perhaps explain to me how does one import a date from a csv file - (obviously import it into a variable) but then how does one compare it to a current date (get-date) and out put the difference between them in Days : So $a = Import-Csv "doc.csv" | $computerdate = $a.LastLogonDate | $newdate = Get-Date | $computerdate - $newdate ????? = I'm a bit lost here...
I think this video will teach you about importing CSV files into PowerShell. ua-cam.com/video/PXBMdIkH24I/v-deo.html You may then need to convert what comes in from the CSV into a date. You can use Get-Date(YourImportedObject) to convert it. Now you have a date. With the date in hand you can do all of the date functions/comparisons you want to do.
Hi Shane, I am returning a value from function and if I am using that return value as a date I am getting the below error. Cannot convert system.object () to system.datetime Can you please help me out with any solution?
I had never thought about this. Looking at this blog post looks like it does a lot more than I would have guessed. www.madwithpowershell.com/2013/10/math-in-powershell.html
Hey Shane, I am trying to compare two formatted dates. Both are technically string objects, however, I would like to compare the DIFFERENCE of the dates. One is a Get-Date that I format to "yyyy-MM-dd hh:mm:ss" the other is a date in that format, which I pull from a CSV file. I would like the output to be an integer. Can you help me out?
@@ShanesCows okay I have looked into it. I found the challenge, because we have leap days 52 or 53 pr. year. For example. 2020 that have 53 and 2022 have 52 days in Powershell language.
Great video! Just wanted to add,
get-date $pig -UFormat %y
This actually returns the year, it returned 17 in the case as it was 2017 at the time. %V returns the week number, the 'v' didn't work in your video because it needs to be upper case.
Thanks for the update. 😀
So much for Windows being case-insensitive..
Shane Young.. you made my learing easier ...I started learning PowerShell by watching your video tutorial. Thanks for the clear and informative content.
Glad to help. Enjoy learning 😀
Congratulations, I'm starting with Powershell and you have the best videos and explanations I have seen about Powershell, you gave me a new approach. Good job. Thanks man!!
Very cool. Thanks for sharing.
Shane, I love your demonstration style. I have struggled with PowerShell, and after watching your videos, I think it is starting to click.
Hey Shane, as i was confused whether to opt to learn powershell or not as most of my friends has confused me that its really tough to learn after watching your series of videos i came to know its not tough, hats off to you as u made it so clear and easy to understand
Awesome! Glad you are learning. 😀
Thanks Shane for the video. Have seen 1 & 2. Just starting with PowerShell but find it very interesting. May have to watch them again. Thanks again!
Enjoy. There is about 40
Thanks Shane! Always a pleasure to learn from you.
Amazing...You make Powershell learning more interesting.Thank you
Thanks!
Brilliant content. straight to the point.
Thanks. About 40 more videos to go. 😎
I learn so much with your videos, thanks!
Awesome 👏
Brilliant lesson, specially the creation time manipulation.
Excellent Tutorial. I hope you'll keep on uploading more content :)
I agree
Thanks. There is over 40 videos to help you. 😀
Great, wonderfully informative...learned to do stuff which I never knew before. -Thanks! ;-)
Awesome 😎
Great video! Thanks!!
Hey man... You are rocking with you videos. Great way of explanation, most important you give full justification to every topic that you have touched.
So with word topic :) Can you make a video with regx explanation (Or Point me if you have already). Thanks in Advance
Glad to help. I haven’t done much with regex sorry 😐
Hi Shane,
When I use the get-date command I get:
August 25, 2023 11:11:23 AM
Everywhere I have searched shows the default output to be
Friday August 25, 2023 11:11:23 AM
What do I have to do to change the format?
I used get-date -uformat %c but it does not change it.
Take care,
Hi there, very simple one. How do you create a batch file to launch powershell in administrator mode without having to press "ok" buttons and to then set some simple environmental variables?
Look for my video on Task scheduler for an idea.
God bless u always . Mate
Thank you Darshan. Very kind of you. Have a great week! 🐶
Hi Shane, thanks for sharing in a very interesting way. At 16:45 into the video I noticed something peculiar. Could you perhaps explain how subtracting 9 months from 11 December 2016 gives 12 July 2016? I would think it to be around 11 or 12 March 2016. Kind regards
Thys I looked through the video and didn't see the part you are talking about? Can you double check your time stamp again? Thanks. Happy to clear up any confusion.
Okay I kept watching and found the confusion. It is around 15:25. You confusion comes from we are setting the value of Zebra.CreationTime = $pig.addmonths(-9). $pig was April 11 so we are subtracting 9 months from that date. The December date was the old value of CreationTime and not part of the math. Does that help?
Shane Young Yes that clarifies it. Thanks.
Hey, great set of videos, sparked an interest for Powershell... But I wonder, how come your text changes color depending on the type of input you write, while mine is always the same color? :L
With windows 10 there is something installed by default called psreadline. I get the question I made a video. ua-cam.com/video/3jAH92mBbRk/v-deo.html
Awesome video Shane! Thank you so much for your great effort. I would like to ask that i got some difference in time format in my output. I have windows10 OS. Below is the example---
PS C:\Users\Ankit Singh> Get-Date
15 September 2017 11:04:19
Here Day is not present.
hi, se puede mostrar hostname and date one line command?
Write-Host "$(hostname) - $(Get-Date)"
Hi Shane,
could you please help me to know how to keep a date constant in powershell so that it can be execute as Subtask later
Please Help!
Not sure. Sorry
i need to print like some logs from 5/2/2020 to 20/12/2020 . what will be code for that ?
Not sure
Hey Shane
New to PS but quickly learning. Mostly thanks to your tutorials.
I have written Create New AD User from CSV file script.
The csv has a date presented as dd/MM/yyyyy, However Powershell pukes at that format and wants it presented as MM/dd/yyyy.
I note i see a post about converting/changing the "culture" but it seems really complicated for just changing the format of the dta as presented.
All other examples i find regarding manipulating DateTime is when using the Get-Date command.
Since i already have the date, i am struggling.
Do you or anyone have a quick and easy method to change the format of the date given to me by another department?
Thanks for all your videos - Cheers
Happy New Year 2021
Mr Weeble
Hey Jeff - I don't. My PowerShell for that stuff is a bit rusty. Sorry
@@ShanesCows Thanks for the response Shane. I need to test, but i believe i have found the solution.
$ProperDateFormat = [datetime]::parseexact($expire, 'dd/MM/yyyy', $null).ToString('MM/dd/yyyy')
Fun to learn, Very helpful. Thanks!
The tutorial is very well done! One annoyance: after every "cls" that you do, if you are in full screen mode, the video title appears whenever you touch the mouse and obscures the stuff you're typing. If not in full screen mode, the text is too tiny to read! Seems like the easiest solution is to simply stop using cls. Other than that, I was properly educated!
Awesome and sorry about the minor issues 😑
Great tutorial! Thanks a bunch 👍
Glad it helped.
superb as always
I know this video is old, just wanted to say thank you. Also could you perhaps explain to me how does one import a date from a csv file - (obviously import it into a variable) but then how does one compare it to a current date (get-date) and out put the difference between them in Days : So $a = Import-Csv "doc.csv" | $computerdate = $a.LastLogonDate | $newdate = Get-Date | $computerdate - $newdate ????? = I'm a bit lost here...
I think this video will teach you about importing CSV files into PowerShell. ua-cam.com/video/PXBMdIkH24I/v-deo.html
You may then need to convert what comes in from the CSV into a date. You can use Get-Date(YourImportedObject) to convert it. Now you have a date. With the date in hand you can do all of the date functions/comparisons you want to do.
Hi Shane, I am returning a value from function and if I am using that return value as a date I am getting the below error.
Cannot convert system.object () to system.datetime
Can you please help me out with any solution?
I think you need to look at the data you are returning and its data tupe
@@ShanesCows thanks for the solution, it's an array type so am getting issue and resolved by your techniques
Thanks for your great videos, very helpful! Can Power Shell do math beyond simple algebra? Can I do trigonometry and other more advanced math?
I had never thought about this. Looking at this blog post looks like it does a lot more than I would have guessed. www.madwithpowershell.com/2013/10/math-in-powershell.html
Thank you 😌
You’re welcome 😊
Great video but wish it showed how to manipulate the date format for more than one row in the column. So close yet so far away! 🙂
How did subtracting 9 months from a creation date of December 2016, become July 2016?
I had to watch to find it. I crossed my variables and caused the confusion 😎 Whoops
Thanks, awesome!
Glad to help. 😀
Hey Shane,
I am trying to compare two formatted dates. Both are technically string objects, however, I would like to compare the DIFFERENCE of the dates.
One is a Get-Date that I format to "yyyy-MM-dd hh:mm:ss"
the other is a date in that format, which I pull from a CSV file.
I would like the output to be an integer.
Can you help me out?
Hi Mack - Email me what you have so far and the details and I will take a look and see if I can easily help. shane.young at boldzebras.com
Can you please explain ,how to write powershell script to get last patched date in windows
I will add patch management to the list.
Very helpful. But can you help me increase a value of time by one click on ưindows?
I haven’t done that before
I am getting a date time value and don't know how to convert it. How would
Powershell Convert 19691231190000.000000 to date and time
Yikes. I haven't had that before. SOrry.
When does your next session start for PowerShell beginners?
Hi Sarah - Will you email me and we can chat about what you are looking for shane.young @ boldzebras.com
Why isn't the time incrementing on your examples around 6 minutes in?
Not sure. Been a long time.
Helped me thank you
Great, thanks!!
What about show total weeks in a year.
Sorry I haven’t done that one.
@@ShanesCows okay I have looked into it.
I found the challenge, because we have leap days 52 or 53 pr. year.
For example. 2020 that have 53 and 2022 have 52 days in Powershell language.
How is December minus 9 months July? O.o