Thanks for the video! Really good idea using indexof, going to use that in my scripts a lot more currently I use the length method to sort mine: $url.substring(0, $url.length -4) Your way is much better when you have port numbers of different sizes. Again thanks!
@ShanesCows7 жыл бұрын
Glad you liked it. Sadly I have to give Todd Klindt credit for pushing me in that direction. :)
@HestnetIT Жыл бұрын
Thanks! The substring function was what I was looking for.
@ShanesCows Жыл бұрын
Glad to help. String manipulation is such a powerful skill.
@samanthagarcia85842 жыл бұрын
4years later and you explained things easier and more detailed than my professor! Thank you.
@ShanesCows2 жыл бұрын
You are so welcome!
@johnnymartin39113 жыл бұрын
I know this is 3 years old, but you've helped me so much with your videos and I've only watched two so far! Thank You!
@ShanesCows3 жыл бұрын
Glad it helped. I have about 40 more videos to help 😎
@jjack98952 жыл бұрын
@@ShanesCows That's crazy...I said the same thing. This is my second video. I've started a OneNote page with your site as a powershell resource, so I can check out the other 40 videos! Lol
@S21002112 жыл бұрын
Another great explanation on how to do something in PowerShell. Many thanks for taking the time to make this video Shane.
@ShanesCows2 жыл бұрын
My pleasure!
@nigelkeyworth52552 жыл бұрын
indexof and substring stuff was really great and well explained. Cheers again
@ShanesCows2 жыл бұрын
Thanks. 😎
@benoitbourque3447 жыл бұрын
You are the man Shane, it means the world to me that you are posting all this great content online. thank you for everything.
@simranverma48594 жыл бұрын
##powershell sessions ##10th may 8.30 pm IST## facebook.com/groups/790933198099023/
@michaelgarner43155 жыл бұрын
The practical examples accompanied by explanation of what each piece of the script does is a great teaching method. Your videos are super helpful. Thank you for producing them! (Love the "wuz" bit! Very funny!)
@ShanesCows5 жыл бұрын
Glad to help and thank you b
@atothek18047 ай бұрын
Thank you so much. Especially use case scenarios helped to root how and where string manipulation could be real day saver. Tnx! 😊😊😊😊
@ShanesCows7 ай бұрын
Glad it helped!
@TheYanivR6 жыл бұрын
Hi Shane, Thanks for all the helping examples. I 'm using PowerShell for some time but still managed to learn some new stuff. Keep with the good work.
@eivenhoe3 жыл бұрын
Nice Video Shane! Thank you a lot
@ShanesCows3 жыл бұрын
My pleasure!
@jamesthomas8249 Жыл бұрын
Learning to use PowerShell to automate work with Office Files, your videos are very helpful. Wish you would increase your Font size.
@ShanesCows Жыл бұрын
Yeah James some of my earlier videos weren't ideal, I get better as they go on. 🫤 Creating content was a learning process for me.
@alexandrevalente99944 жыл бұрын
Thanks a lot. I come form the Unix world and used most of the time ksh and bash. Very good tutorial.
@ShanesCows4 жыл бұрын
Glad it helped.
@purplemonkeydishwasher52694 жыл бұрын
nice presentation. Great approach to the topic
@ShanesCows4 жыл бұрын
Thank you kindly!
@satishkumar61196 жыл бұрын
Hi Shane. Thanks for these good videos on Powershell. I was very confused with Powershell earlier but now I can easily learn from these videos. You are simply awesome who is sharing such a valuable information absolutely free to help others. Hats off to you bro
@ShanesCows6 жыл бұрын
Thank you for your kind words. :)
@MrSelecta32 Жыл бұрын
Nice examples. I laughed so hard when you corrected "on-premise". Its almost an IT joke now. About time we got over it dont you think?
@ShanesCows Жыл бұрын
Agreed. I also never like the boundary. 😎
@MrSelecta32 Жыл бұрын
@@ShanesCows somehow its ok to abbreviate to on-prem but heaven forbid you abbreviate to on-premise.
@Pittsburghfix6 жыл бұрын
Shane, Thanks for the great lesson. That last command solved my problem !
@ShanesCows6 жыл бұрын
Awesome!
@jorgesanchezcruz60093 жыл бұрын
Thanks Shane, Thanks a lot.
@ShanesCows3 жыл бұрын
Glad to help Jorge.
@tsmspace5 жыл бұрын
Im going to rewatch it when Im on my computer. Im pretty stoked about powershell suddenly. Ive been learning basic python, and my new computer runs powershell as the default vscode terminal, which is supercool. I figured out this morning how to run python code, where the stdout is in a powershell color I define by "| write-host -foregrcol " after the python call. (I was running a web scraper over and over and wanted each run to have a new color so I could quickly find the top of the html
@ShanesCows5 жыл бұрын
PowerShell is awesome! Enjoy. :)
@AndrewParkinson17 жыл бұрын
Brilliant! I learn and I laugh. Thanks Shane.
@Silvermist78 Жыл бұрын
Shane: PS Hero! 💪💪👏
@ShanesCows Жыл бұрын
Thanks! Learning to parse strings is important in any language!
@stevenstewart59806 жыл бұрын
Thanks for another very helpful video, Shane. Perhaps you have already covered it in another video, but I have a lot of trouble with concatenating strings in PowerShell. It seems very different from other languages. If you haven't covered it yet, please do when you have a chance.
@ShanesCows6 жыл бұрын
Not sure I have a video on it. What are you trying to do exactly? Maybe I can help
@prasannakumar49045 жыл бұрын
Thanks for the session
@ShanesCows5 жыл бұрын
Happy to help
@MatthewLCarter6 жыл бұрын
at around 11:38 in the video, I like that $cow.Substring(3,4) could be helpful with the "4" bit, to remove say *.txt to remove that . and the txt or last three filename extensions.
@ShanesCows6 жыл бұрын
I like the thinking.
@nanangzulkarnain62395 жыл бұрын
Thanks Shane
@ShanesCows5 жыл бұрын
You got it 😀
@manuelpaulino31906 жыл бұрын
Awesome content Shane!
@ShanesCows6 жыл бұрын
Thank you.
@VaibhavKumar-tc1go3 жыл бұрын
Great, practical examples were helpful
@ShanesCows3 жыл бұрын
Glad to hear that!
@tarplahanderson42076 жыл бұрын
Thanks for your knowledge and time!!
@fatimahrafiq83233 жыл бұрын
Awesome video.
@ShanesCows3 жыл бұрын
Glad you enjoyed it
@djdingle2475 жыл бұрын
Hello Shane!! This helped. I want to take it just a little farther. I need to get a list of the local users Get-LocalUsers. I made it a Var $LclUsr = Get-LocalUser. It gives the Name, Enableed, and Description. I need to parse the Enabled header (which is either True/False). and if one of the Names is False when it should be True output the info and vice versa if True when it should be False. I was told Select-String would be the best route.
@ShanesCows5 жыл бұрын
Not sure. Sorry
@Pithecanthropus2483 Жыл бұрын
Great video so far, though I've only watched a little. I've been wanting to learn Powershell because I need to alter the timestamps on several thousand files, based on the filenames, which themselves are timestamps. So I have a file 2022-01-27_17:14:09.mp4, but the timestamps got clobbered when the file was copied to a different directory. So I need to pull the date and time elements out of the filenames, and use them to build the appropriate timestamps. From what I've seen about Powershell, here and elsewhere, it should enable me to do that. Thanks for the great video.
@PabloVillaronga4 жыл бұрын
Great Video share, i learn a lot , the easy way ! Wouldn;t be great if you post the link to the powershell you explained to Github or your site,like a blog ? Would be easy to execute and get out exercises !
@ShanesCows4 жыл бұрын
Replies to other comment
@drakouzdrowiciel92375 жыл бұрын
Thanks for the video
@ShanesCows5 жыл бұрын
Welcome
@dustinsullivan38722 жыл бұрын
I'm a beginner to PowerShell if ya know where to pick up books for it please lemme know thanks loved ur tuts
@peters40482 жыл бұрын
Hi , I've been watching a few of your videos and have helped me understand powershell better. Are you able to recommend any sites that have exercises that can be used to help apply what you teach in your videos.
@ShanesCows2 жыл бұрын
Hey Peter I don’t. Boo me. PowerShell.org would be where I would tell you to look.
@tinalee30294 жыл бұрын
Hi Shane! Thanks for posting these great videos. I'm looking forward to the Copy, Move, Delete Files. Will it work to move pretty much one "computer" to another over a network? I have been doing that slowly with a computer I restored from absolutely nothing. Learning as I go. I would also love to be able to copy file names into excel. Looking for that function. Could you point me to the place to look and read, please?
@ShanesCows4 жыл бұрын
I haven’t done to Excel before. Sorry
@2bonk224 жыл бұрын
Can power shell be used to co-ordinate the multiple windows programs? I have an elaborate project in mind that involves gathering input from two wifi routers, a camera, the system clock for timestamp, the output from a program running on the computer, and a little easy math. All of it needs to be stored to disc in a coherent form. I know this is quite advanced but is it doable or should I find another way to do it?
@ShanesCows4 жыл бұрын
Maybe? Without knowing lots more details o don’t know.
@Skeemin4dadoe5 жыл бұрын
This just saved me an hour of sifting throughout technet
@ShanesCows5 жыл бұрын
Awesome!!!
@ulfgj6 жыл бұрын
shane. u da best.
@ShanesCows6 жыл бұрын
THANKS!!!!
@mariosantini17543 жыл бұрын
Do you have any videos on replacing and adding lines to specific lines in a text file? From PowerShell
@ShanesCows3 жыл бұрын
I think this is the closest thing I have. 😑
@lordvader4823 Жыл бұрын
Good day Shane. I have a question in regards to using power shell to input a string to a website specific settings in custom properties. For example: I am attempting to add monitoring nodes to a website, in the node settings there are inputs you can manually type in. Specific: There is a settings you can manually type in under “Custom_Comment”. How would I create a script to look for Custom Comment in the properties section then add a string like “Newly Added” I have this so far. $nodeList += [pscustomobject]@{Caption = ‘name of node’ : ipAddress = $ipaddress : Custom_Comment = “Newly Added”} My issue is, the string Newly Added doesn’t add that string to the Custom Comment section in the node properties. Any advice?
@ShanesCows Жыл бұрын
Sorry, it has been too long since I have done PS that deeply. :(
@dennismagee9486 Жыл бұрын
How would you trimend a file name or directory name? Like change DG-0101-1-1 to DG-00101-1
@tommyfender19686 жыл бұрын
This might be my solution.., but I’m a brand new scripter.. might need the mentoring
@ShanesCows6 жыл бұрын
Happy to help if you do. BoldZebras.com there is a contact form at the bottom if you want more info. Thanks
@robertjones56694 жыл бұрын
Hi Shane, I recently subscribed to trhe channel - and recently have become interested in powershell. I'm periodically tasked with sifting through a dump of data that contains only a couple of columns that I'm interested in, but one has free formed text as in "notes". I'd love to learn how to read in this file, parse through it, create new columns, remove Parens () and be able to quantify this biz intel elegantly. Any guidance would be greatly appreciated.Best Regards, Rob USN Retired
@ShanesCows4 жыл бұрын
Check out the video on arrays to get you started.
@michaelbabbitt38376 жыл бұрын
Shane, I followed the instructions concerning $cow but it did not create any text objects in my directory.
@ShanesCows6 жыл бұрын
Hey Michael - What part? can you give me a timestamp for the section that isn't working for you . I use $cow a lot. :)
@teja16485 жыл бұрын
Hi Shane, How to read the Excel file content and take that as a input in Jenkins?
@ShanesCows5 жыл бұрын
Look for my video on arrays
@digvijaysingh80775 жыл бұрын
Hi Shane, I need to replace nth occurrence of a string in a file , could have done easily in unix using sed. But replace doesn’t have the option to replace a particular occurrence. Suppose i have a file , having 10 occurrences of word “Shane” , and i wanna replace only 5th occurrence . Can you please help 🙏🏻🙏🏻🙏🏻
@ShanesCows5 жыл бұрын
I haven't done that before. Sorry. :(
@magombre6 жыл бұрын
Hey can you please help me out, I'm trying to get the difference between two strings but I'm having no success. For example $string1 = 'hello' and $string2 = 'hello shane' , the function that Im trying to make should print out shane . The java equivalent for this function is StringUtils.difference(String first, String second) but I can't seem to manage to do it in powershell. Thanks a lot in advance and great videos!
@ShanesCows6 жыл бұрын
I don’t have it in front of me. But roughly. $newstring = $string2.replace($string1, “”) I typed that on my phone so sorry for typos.
@magombre6 жыл бұрын
Awesome, that worked perfectly! Thanks a lot for the quick response :)
@faqasim2 жыл бұрын
I am working PSADT and I am trying to install an EXE when i run the "Execute-Process" "The term "Execute-Process Does not...Also sometimes i get Function Failed, setting exit code to 60002. Please Please help me!!!!!
@mkx92574 жыл бұрын
Hey shane... Is there anyway to replace a certain value in your script and to make the script run in a loop while replacing that particular value???
@trogdorstrngbd4 жыл бұрын
Can you explain in more detail? Are you trying to make the script dynamically rewrite its own code (which is kind of doable but highly not recommended)?
@mkx92574 жыл бұрын
@@trogdorstrngbd so basically im working with a company to deploy microsoft teams to schools for online classes. The thing is making that many teams is a problem since just about every school has 1-10/12 grade and over 3-4 sections. I was trying to find a way to add multiple users to multiple teams. I tried using csv files to make life easier but somehow i get an error "cannot bind argument to parameter because it is null"
@trogdorstrngbd4 жыл бұрын
@@mkx9257 I would guess some of the entries in the CSV are blank. Check for that first ($something -eq $null should work, but maybe also try the empty string ""), especially making sure to exclude header and footer rows if they exist. If those blanks are due to student data actually being unknown/missing, come up with default values for them.
@mkx92574 жыл бұрын
@@trogdorstrngbd thanks a lot... I've tried the empty string and the csv doesnt have blanks... That's the whole reason i'm stumped... I'll try the $something -eq null...
@trogdorstrngbd4 жыл бұрын
@@mkx9257 I remembered one more thing: PowerShell returns $null instead of an error for uninitialized variables. For example: PS> $FakeVariable -eq $null True PS> $ShortList = 1..10; $ShortList[100] -eq $null True
@ozzysideika78405 жыл бұрын
Hello, I want to make a ps script which opens up and logs in into "keepass" and other applications as soon as I log in. I read everywhere to try and find a solution but I can't find anything, any thoughts? Is there a command which you specify an input and then another command which will actually type in the paramater set into the text box. Thanks in advance
@ShanesCows5 жыл бұрын
Sorry Ozzy. I have never tried. Let me know if you come up with anything.
@GBPveko5 жыл бұрын
how about replacing/removing similar characters inside .txt files EX: replace ",,", "" how would that be done similar to what you are doing in renaming the file names via powershell?
@ShanesCows5 жыл бұрын
Never tried. Does what you have there not work?
@kacemsys7 жыл бұрын
Hi, firstable , thank you so much for your very helpfull tutorials , i want to know why you didn't use TrimEnd to exclude ":443" instead of substring and indexOf $newUrl.TrimEnd(":443") is there any inconvenient ?
@ShanesCows7 жыл бұрын
In theory you could. What I have found in my real world scripts is I end up with too much inconsistency with TrimEnd and TrimStart not doing what I want. Especially with URLs. www.boldzebras.com www.boldzebras.com:443 and www.boldzebras.com/ all are valid URLs for the same site but require slightly different Trims.
@andy123smith4 жыл бұрын
Hi , you have great videos and Iv learned a lot from them. Question though.. how do you output specific bytes in the string? Say you output is ‘abcde12345’ can pull the 4th to the 9th byte The output would then be ‘e12345’ is this possible? Hope that makes sense...
@ShanesCows4 жыл бұрын
I thought that was covered in this video using the string methods?
@andy123smith4 жыл бұрын
Shane Young I found that .substring maybe the was forward, are you able to do a video on the right use of that?
@andy123smith4 жыл бұрын
Oh it is there.. I must be using it wrong as I don’t seem to be able to get it to work
@andy123smith4 жыл бұрын
My query is as below $transact= Get-ChildItem -path “pathname” -Recurse | Where extension-EQ .dat Foreach ($file in $transact) { Get-Content $file.FullName } This then gives you the correct output, of what’s in the folders. It’s a long and all I want is from the 3rd to the 12th character. I’ve tried changing Get-content $file.FullName to .substring(3,12) but it doesn’t like it Any help would be greatly appreciated
@andy123smith4 жыл бұрын
Got it, within the loop create a variable $filename= Get-Content $file.FullName $filename.substring(3,10) Made me think this one...
@dustinsullivan38722 жыл бұрын
Shane I'm on a phone could ya make your commands bigger
@ladeleajao86274 жыл бұрын
please what kind of mic are you using?
@ShanesCows4 жыл бұрын
A Yeti Blue. If you email me shane at powerapps911.com I can send you a list of all of the equipment I use.
@ladeleajao86274 жыл бұрын
@@ShanesCows hello, i have email you, waiting for your response
@mazenmmha1856 жыл бұрын
plz how i can add suffix to group of files >>>suffix is letters like.mp3 nether number or order
@ShanesCows6 жыл бұрын
Open PowerShell and type: get-help Rename-Item -Examples In the examples is exactly what you are looking for. -Shane
@IamWaliJan6 жыл бұрын
Hey Shane, Why not like this $url.TrimStart("").trimend(":8080") but Thanks buddy this is what i am doing after watching your videos :)
@ShanesCows6 жыл бұрын
That would work. As with a lot of things in PowerShell there are a lot of ways to do things. Replace was top of mind that day so that is what got used. :)
@BADRUBULDURA3 жыл бұрын
🙂
@ShanesCows3 жыл бұрын
🤩
@hp3kguy6 жыл бұрын
I tried the trimstart and it fails; with the following error when attempting a Get-Help. Not sure what this means. Checking Google get-help trimstart get-help : Get-Help could not find trimstart in a help file in this session. To download updated help topics type: "Update-Help". To get help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116. At line:1 char:1 + get-help trimstart + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand
@hp3kguy6 жыл бұрын
btw: I did the Update-Help and still get the error?
@ShanesCows6 жыл бұрын
I replied to your other comment.
@hp3kguy6 жыл бұрын
got it working; with some command syntax corrections! Thanks for your repsonse!
@hp3kguy6 жыл бұрын
Great teaching skills! I am trying to use the TrimStart & Indexof and I get errors. I attempt to do a Get-Help against the cmd's and here's what I get. I'm wondering if I running an outdated version of powershell? get-help : Get-Help could not find indexof in a help file in this session. To download updated help topics type: "Update-Help". To get help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116. At line:1 char:1 get-help Indexof get-help : Get-Help could not find indexof in a help file in this session. To download updated help topics type: "Update-Help". To get help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116. At line:1 char:1 + get-help indexof + ~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand
@ShanesCows6 жыл бұрын
I checked my machine also. The string methods don't have help for them. :( Anything I can try to help with?
@yaroslavpanych20672 жыл бұрын
It is not a task of Help subsystem to keep info about .Net basic functionality, MSDN is what does it. PS is essentially .NET REPL environment. Question about basics of .NET have to be asked at appropriate place - MSDN!
@ramakaddagalla79556 жыл бұрын
Hey Shane, Awesome Commands . I am new to powershell ,i know basic things in Powershell. I want to learn powershell more. I faced issue in my Active Direcotry environment like .pulling the data in between bracess {***********} My problem is in my ad environment user have multiple proxy addresses i want the data like Data contain like user {proxyaddress1,proxyaddress2,proxyaddress3"} username proxyaddress ========================== user1 proxyaddress1,proxyaddress2,proxyaddress3 user2 proxyaddress1,proxyaddress2,proxyaddress3 user3 proxyaddress1,proxyaddress2,proxyaddress3 Please let me know Your views how to get the data Thanks ===== Rama
@jaymartini3 жыл бұрын
1
@ShanesCows3 жыл бұрын
2 😂
@jaymartini3 жыл бұрын
@@ShanesCows Hahahah. I guess I fat-fingered a comment from my phone. But since you're here, great content! I've never been interested in PW but you make it interesting.
@ShanesCows3 жыл бұрын
@@jaymartini This is why I reply to all of them. Little things like "fat fingering on my phone" make me smile more than you will ever know. 🐶
@jaymartini3 жыл бұрын
@@ShanesCows Then I'm your Huckleberry!
@prontopuntor5 жыл бұрын
$hostname = ([System.Uri] $url).Host
@ShanesCows5 жыл бұрын
Cool
@yaroslavpanych20672 жыл бұрын
Absolute disappointment! Just say "Strings in PS, as all objects in PS, are strings of .Net, go open reference. End of video". If for someone it is not enough their real job is janitor, and nothing related to computers!