Thank you for these PowerShell videos! I've really been struggling and afraid of scripting. You made it way easier for me to get into, and i'm actually enjoying working on that! Thanks again :)
You're making me really like PowerShell... again! I got away from using it and then had to jump back in with some intrepidation and a healthy dose of trepidation in my current gig. Am faced with learning a PS script that is overloaded with C++ and C# coding characteristics, but also using some Hungarian notation that has me pulling my hair out... what little I have left. However, your explanations are so calming (and at times a little humorous) that I'm able to sigh and say "This ain't so bad" and I've actually played around with your last ForEach-Object example in this video to get some good stuff out of my script... Yay..! Awesome job on the video!
Hey Shane, thanks so much for making these videos. I've read books on PowerShell, but there's NOTHING like learning visually. Your videos are simple to understand, and follow along and makes it easier for me to WANT to learn PowerShell. Thanks again. If I come across topics I want to learn more about, I will send a comment to see if you can make a video. Have a great day!
@shaneyoung is awesome, Shane is cool.... you forgot to mention "Shane is good at educating people". I never get tired of watching these PS script presentation of yours. Thank you Shane for sharing! GOD Bless!
Hi Shane! Great video as always, I'm learning a lot and having so much fun. Just a quick note: I know this video was made almost two years ago and I'm not sure whether Excel or PowerShell new versions have anything to do with this, but I had a bit of a brainer with the import-csv table format as all data was displaying in strings separated by semicolons, merging the information from columns A, B and C, instead of the nice and neat table you are showing. Got a bit frustrated until I figured out I was missing the -delimiter ";" at the end of line 1 (and 3, subsequently). Not sure if it has happened to anyone else following your vids on 2019, but whatever the case, you are a Rockstar and I thought you might want to know in case the feedback is interesting enough for other people. Keep up the amazing work and thank you again!
I’ve always been confused by this. If the pipe sends three objects to the next commandlet, why is it necessary to iterate over them in a foreach-object?
Thanks, Shane! Is there any way to compare the contents of multiple files (two folders, different versions)? Compare-object seems to only provide the basic info of different file names.
Thank you! You don't know how much that means to me. I spend way too much time trying to get the first minute right to get people to watch the whole thing.
If I change the value after -gt to, something else, say, 500 or 5000, then the write-host statement is not being executed. I think, the reason behind it is that the ObjectPropertyNumber is of String type. I wish you added a step to convert it to integer.
Hello Shane, I really need a quick help from your side as I need to copy/clone Azure Data Factory entities like Linked services,Datasets, Piplines, Triggers from one environment to another using Powershell only so that it will take value dynamically.The reason is that some of these pipelines may change and it is hard to keep up with changes.So, can it be possible to get all the data from data factory using power shell and then can make a clone of it, because if we update a pipeline, it would be great to copy and paste the logic. It will be of great help if any assistance is provided from your end. Thanks in advance !!! Awaiting for your valuable reply.
Great another awesome topic I'm gonna be able to use. Hoping to use for remote server functions. Being able to distingush the whole "DEV" group will be handy. Thanms
Hi Shane, Nice video :) I need to retrieve Power BI data such as workspace, dataset, dataflows, reports, users etc. Either, this data will come via using one command OR with multiple command yields individual data for every entities with proper foreign key relation ship between them but in either case i dont want to pass any parameter to PowerShell command to retreive result. OR is there any other way out to retrieve such required result. Thanks Amit
hi Shane, have you covered error catching in one of your PowerShell videos as I have tried to learn this in the past and I’m having a real hard time getting my head around it. also really appreciate these videos they've shown me a few ways of doings things easier in my scripts. thanks
Shane I'm having trouble with powershell, doing the same as above, but I want to send mail message for each line from my CSV. Wondering if you could help?
If you don't get the colored text to work, be sure to save .csv as CSV-UTF8. Regular CSV Comma delimited won't work. I'm using office 365/2016, so may be a quirk.
Hi Shane, I am having a PS coding mental block where I can't figure out how to change the values of a column in a csv file and then output the updated csv. Essentially, I want to take the column "group owner" where the names are listed in displayname format (i.e., "John Smith") and convert them to their respective SamAccountName (i.e., jsmith) and then export the updated csv that now lists all groupowners in SamAccountName format. I've seen solutions online where the script takes the first and last name and "creates" SamAccountNames but that is not a solution in my case because at our company a user's samaccountname is not necessarily first initial+lastname because there are several people that would end up with the same samaccountname in AD which is not acceptable. My script would need to contain the code "$SamAcctName = Get-ADUser -filter (Name -like "$_.groupowner) | Select Samaccountname" to get the owner's actual samaccountname. My issue is that although my for-eachobject loop is processing each entry of the "groupowner" , it is not saving the person's samaccountname into the variable $SamAcctName. Instead, the output for $SamAcctName is blank. Below is my code. I'm hoping that you can spot what I am doing wrong and provide me with the correct code. Thank you in advance. $csv = Import-Csv C:\Temp\TestCsv.csv $csv | ForEach-Object { # sending current value of $_.groupowner to host screen as a control Write-Host "The group owner is:" $_.groupowner # grabbing this group owner's Samaccountname from AD and assigning that value to the variable $SamAcctName $SamAcctName = Get-ADUser -filter 'Name -like "$_.groupowner"' | Select SamAccountName # Here is my attempt at replacing the display name of the group owner with his Samaccountname (username) # by assigning the $_.groupowner item the value contained in $SamAcctName $_.groupowner = $SamAcctName Write-Host "This group owner has samaccountname:" $SamAcctName } Export-csv C:\temp\TestCsv.csv -NoTypeInformation
Hello Shane, Thank you for the videos. I am working on a New user onboarding script and stuck at adding users to the security as well as distribution groups based on location and department. Basically i have a CSV with Location,FirstName,LastName,Department and using IF statements to move users to the location based on the CSV file and able to create users. I am using the same Logic using the IF statement to add users to the security group based on location and department but seems the script only works just one user and remaining untouched. Below is the code for your reference: #Adds user into Department specific security groups If ($Dept -eq 'IT') { Add-ADGroupMember -Identity "IT Security Group" -Members $SAMAccountName } ElseIf ($Dept -eq 'Accounts') { Add-ADGroupMember -Identity "Accounts Security Group" -Members $SAMAccountName } #Adds user into Location specific security groups If ($Location -eq 'Location') { Add-ADGroupMember -Identity "Location Distribution Group" -Members $SAMAccountName } ElseIf ($Location -eq 'Location 2') { Add-ADGroupMember -Identity "Location2 Distribution Group" -Members $SAMAccountName } Can you please advise what am i doing wrong here as i have serached online for long hours and could not make this to work. Appreciate your help on this.
Hey Shane, great video. Really helped me understand the concept of manipulating each row in a CSV and assigning a number value for whatever purpose you need it for. I have a question, how would I manipulate each character from a specific row? For example, in one row I need to evaluate a computer's specs based on a specific number character in the 20th position from the left of the row. If that 20th position character is an i5 (5 being the important piece here) then i do something... how do I read that 20th position of the row. Hope that makes sense....
Could you program how to program our script if we had a column called Date and we would like to sort our array in Powershell regarding the values in the cells of Date column? Great videos! Like!
It's a ledger and I'd like to have an input csv completly rearranged by the date column and save it to an ouput csv file. I guess it involves parsing every value in the cell date to an object date but then I dont know how to do it. Could you please elaborate the solution! Thank you for answering! Your videos are very explanatory! Best regards.
Thanks so much! I am really enjoying this playlist. You are very likable, and easy to learn from. Question about this video: From 13:55 thru 14:00, why didn't "this object is bigger than 1000" get written for every iteration of the loop? Since the variable was NOT reinitialized for the second run, it ended up containing 22,200. Therefore, during that 2nd run, that line of text should have been written to the screen three more times. No?
It does. If you watch a few seconds earlier 13:53 I reran the lines so the screen flashes and you can see all three lines are written to the screen again. It happens quickly but you are correct, the screen does get written again as I am making the variable 22,200.
I believe you are talking about the lines that say, "The name of the object is..." However, I was talking about the line that says, "This object is bigger than 1000." Anyway, I eventually figured out my mistake: The if statement is evaluating the value contained in the ObjectPropertyNumber property, NOT the value contained in the $TotalOfNumberColumn variable. Anyway, thanks for the reply -- I know your time is valuable.
Thanks for another helpful video, I just subscribed! Would you consider making a video about PS functions like this one th-cam.com/video/BdfVsoMVz8g/w-d-xo.html but without so much jargony, computer sciencey language? I really need learn what is being taught in that lesson but it's a bit advanced, assumes some knowledge, and is targeting PhDs in computer science. :-)
Thanks for this video, almost five years later continues to be very useful!
Great to hear!
Thanks for your time, Shane. Greetings from Scotland.
Thank you! Greetings right back at you. 😎
These videos are helping me so much for my exams THANK YOU!!!
Awesome!
Thank you for these PowerShell videos! I've really been struggling and afraid of scripting. You made it way easier for me to get into, and i'm actually enjoying working on that! Thanks again :)
PowerShell is so much fun. Enjoy. 😎
You're making me really like PowerShell... again! I got away from using it and then had to jump back in with some intrepidation and a healthy dose of trepidation in my current gig. Am faced with learning a PS script that is overloaded with C++ and C# coding characteristics, but also using some Hungarian notation that has me pulling my hair out... what little I have left. However, your explanations are so calming (and at times a little humorous) that I'm able to sigh and say "This ain't so bad" and I've actually played around with your last ForEach-Object example in this video to get some good stuff out of my script... Yay..! Awesome job on the video!
Awesome 😎
Hey Shane, thanks so much for making these videos. I've read books on PowerShell, but there's NOTHING like learning visually. Your videos are simple to understand, and follow along and makes it easier for me to WANT to learn PowerShell. Thanks again. If I come across topics I want to learn more about, I will send a comment to see if you can make a video. Have a great day!
Glad you like them!
HI Shane,
Your tutorials are very informative and I am learning out of it. Thank you!!!
Thanks! :)
@shaneyoung is awesome, Shane is cool.... you forgot to mention "Shane is good at educating people". I never get tired of watching these PS script presentation of yours.
Thank you Shane for sharing! GOD Bless!
Very kind of you. Have a great weekend!
Your tutorials are really awesome and very informative .Thanks
Glad you like them!
Man, you're great. Too bad this video has just over 100 likes - it's worth millions. Keep up the good work!
Your comment is worth millions to me. Thanks! 😎🤑
Thanks Shane, very useful and easy to understand..
Glad to help. 😀
I got you as my first Powershell instructor.. :)
Awesome 🤩
Hi Shane! Great video as always, I'm learning a lot and having so much fun. Just a quick note: I know this video was made almost two years ago and I'm not sure whether Excel or PowerShell new versions have anything to do with this, but I had a bit of a brainer with the import-csv table format as all data was displaying in strings separated by semicolons, merging the information from columns A, B and C, instead of the nice and neat table you are showing. Got a bit frustrated until I figured out I was missing the -delimiter ";" at the end of line 1 (and 3, subsequently). Not sure if it has happened to anyone else following your vids on 2019, but whatever the case, you are a Rockstar and I thought you might want to know in case the feedback is interesting enough for other people. Keep up the amazing work and thank you again!
Awesome. Thanks for sharing.
For me worked -UseCulture at the end of the line (PowerShell 7.1).
East or West Shane is the Best ❤️
Thanks
I’ve always been confused by this. If the pipe sends three objects to the next commandlet, why is it necessary to iterate over them in a foreach-object?
Because you want to run the cmdlet 3 times, once for each object.
Hey Shane, can you show how to import bookmarks,favorites from chrome to edge using powershell
Thanks, Shane! Is there any way to compare the contents of multiple files (two folders, different versions)? Compare-object seems to only provide the basic info of different file names.
I am not sure. 😑 I haven't tried that one before.
Hi Shayne I need help on comparing 2 csv files and displays their differences...ty
Sorry I don't have a video on that.
You have the best intro!
Thank you! You don't know how much that means to me. I spend way too much time trying to get the first minute right to get people to watch the whole thing.
@@ShanesCows Heeeeere is our intro 👉👉
If I change the value after -gt to, something else, say, 500 or 5000, then the write-host statement is not being executed. I think, the reason behind it is that the ObjectPropertyNumber is of String type. I wish you added a step to convert it to integer.
Sorry it didn’t work for you.
@@ShanesCows it's not my fault, the object is string. You can't compare string to integer.
Hello Shane,
I really need a quick help from your side as I need to copy/clone Azure Data Factory entities like Linked services,Datasets, Piplines, Triggers from one environment to another using Powershell only so that it will take value dynamically.The reason is that some of these pipelines may change and it is hard to keep up with changes.So, can it be possible to get all the data from data factory using power shell and then can make a clone of it, because if we update a pipeline, it would be great to copy and paste the logic.
It will be of great help if any assistance is provided from your end.
Thanks in advance !!! Awaiting for your valuable reply.
Sorry not sure.
Hi shane..can you make a video for rest api through powershell
I haven't done much with that. Sorry.
Great another awesome topic I'm gonna be able to use. Hoping to use for remote server functions. Being able to distingush the whole "DEV" group will be handy. Thanms
Cool
Hi Shane,
Nice video :)
I need to retrieve Power BI data such as workspace, dataset, dataflows, reports, users etc.
Either, this data will come via using one command OR with multiple command yields individual data for every entities with proper foreign key relation ship between them but in either case i dont want to pass any parameter to PowerShell command to retreive result.
OR is there any other way out to retrieve such required result.
Thanks
Amit
I am sorry, I don't know.
hi Shane, have you covered error catching in one of your PowerShell videos as I have tried to learn this in the past and I’m having a real hard time getting my head around it.
also really appreciate these videos they've shown me a few ways of doings things easier in my scripts.
thanks
Sorry. I haven’t. It is a topic I have always wanted to tackle and just have not.
Shane I'm having trouble with powershell, doing the same as above, but I want to send mail message for each line from my CSV.
Wondering if you could help?
What have you tried? Send-mailmessage should be all you need.
If you don't get the colored text to work, be sure to save .csv as CSV-UTF8. Regular CSV Comma delimited won't work. I'm using office 365/2016, so may be a quirk.
Thanks
Hi Shane, I am having a PS coding mental block where I can't figure out how to change the values of a column in a csv file and then output the updated csv. Essentially, I want to take the column "group owner" where the names are listed in displayname format (i.e., "John Smith") and convert them to their respective SamAccountName (i.e., jsmith) and then export the updated csv that now lists all groupowners in SamAccountName format. I've seen solutions online where the script takes the first and last name and "creates" SamAccountNames but that is not a solution in my case because at our company a user's samaccountname is not necessarily first initial+lastname because there are several people that would end up with the same samaccountname in AD which is not acceptable. My script would need to contain the code "$SamAcctName = Get-ADUser -filter (Name -like "$_.groupowner) | Select Samaccountname" to get the owner's actual samaccountname.
My issue is that although my for-eachobject loop is processing each entry of the "groupowner" , it is not saving the person's samaccountname into the variable $SamAcctName.
Instead, the output for $SamAcctName is blank. Below is my code. I'm hoping that you can spot what I am doing wrong and provide me with the correct code. Thank you in advance.
$csv = Import-Csv C:\Temp\TestCsv.csv
$csv | ForEach-Object {
# sending current value of $_.groupowner to host screen as a control
Write-Host "The group owner is:" $_.groupowner
# grabbing this group owner's Samaccountname from AD and assigning that value to the variable $SamAcctName
$SamAcctName = Get-ADUser -filter 'Name -like "$_.groupowner"' | Select SamAccountName
# Here is my attempt at replacing the display name of the group owner with his Samaccountname (username)
# by assigning the $_.groupowner item the value contained in $SamAcctName
$_.groupowner = $SamAcctName
Write-Host "This group owner has samaccountname:" $SamAcctName
}
Export-csv C:\temp\TestCsv.csv -NoTypeInformation
Not sure. Sorry
No worries, I spotted my error and fixed it. Thank you for looking into it though. Enjoy your labor day weekend
Thank you for the great tutorial!
You are welcome. Thanks for watching and I am always open to new video ideas.
Thank you Shane. Great videos!!!
Hello Shane,
Thank you for the videos.
I am working on a New user onboarding script and stuck at adding users to the security as well as distribution groups based on location and department.
Basically i have a CSV with Location,FirstName,LastName,Department and using IF statements to move users to the location based on the CSV file and able to create users. I am using the same Logic using the IF statement to add users to the security group based on location and department but seems the script only works just one user and remaining untouched. Below is the code for your reference:
#Adds user into Department specific security groups
If ($Dept -eq 'IT')
{
Add-ADGroupMember -Identity "IT Security Group" -Members $SAMAccountName
}
ElseIf ($Dept -eq 'Accounts')
{
Add-ADGroupMember -Identity "Accounts Security Group" -Members $SAMAccountName
}
#Adds user into Location specific security groups
If ($Location -eq 'Location')
{
Add-ADGroupMember -Identity "Location Distribution Group" -Members $SAMAccountName
}
ElseIf ($Location -eq 'Location 2')
{
Add-ADGroupMember -Identity "Location2 Distribution Group" -Members $SAMAccountName
}
Can you please advise what am i doing wrong here as i have serached online for long hours and could not make this to work.
Appreciate your help on this.
Not sure. Sorry
Great instruction, great video. Thanks!
You are welcome.
Hey Shane, great video. Really helped me understand the concept of manipulating each row in a CSV and assigning a number value for whatever purpose you need it for. I have a question, how would I manipulate each character from a specific row? For example, in one row I need to evaluate a computer's specs based on a specific number character in the 20th position from the left of the row. If that 20th position character is an i5 (5 being the important piece here) then i do something... how do I read that 20th position of the row. Hope that makes sense....
Look for my video on string manipulation
Good video, Shane. Thank you.
Happy to help Talos
Sir, Really helpful.
Thanks
Could you program how to program our script if we had a column called Date and we would like to sort our array in Powershell regarding the values in the cells of Date column? Great videos! Like!
Do you want to sort the array while you are working with it in PowerShell or save it to a CSV file that is ordered by date?
It's a ledger and I'd like to have an input csv completly rearranged by the date column and save it to an ouput csv file. I guess it involves parsing every value in the cell date to an object date but then I dont know how to do it. Could you please elaborate the solution! Thank you for answering! Your videos are very explanatory! Best regards.
I have a task I need to do can you help me
Sorry I am behind on comments. Hope you got it figured out.
Thanks you, great video.
Hi There, good effort but in the first 6' , I don't see anything clearly ....Plz clear your camera. Regards PE
Hey, sorry you are having troubles. Must be your internet or TH-cam settings. I double checked and the video shows in hi definition for me.
Thanks so much! I am really enjoying this playlist. You are very likable, and easy to learn from. Question about this video: From 13:55 thru 14:00, why didn't "this object is bigger than 1000" get written for every iteration of the loop? Since the variable was NOT reinitialized for the second run, it ended up containing 22,200. Therefore, during that 2nd run, that line of text should have been written to the screen three more times. No?
It does. If you watch a few seconds earlier 13:53 I reran the lines so the screen flashes and you can see all three lines are written to the screen again. It happens quickly but you are correct, the screen does get written again as I am making the variable 22,200.
I believe you are talking about the lines that say, "The name of the object is..." However, I was talking about the line that says, "This object is bigger than 1000." Anyway, I eventually figured out my mistake: The if statement is evaluating the value contained in the ObjectPropertyNumber property, NOT the value contained in the $TotalOfNumberColumn variable. Anyway, thanks for the reply -- I know your time is valuable.
Shane is Awesome
Thank you
Thanks for another helpful video, I just subscribed! Would you consider making a video about PS functions like this one th-cam.com/video/BdfVsoMVz8g/w-d-xo.html but without so much jargony, computer sciencey language? I really need learn what is being taught in that lesson but it's a bit advanced, assumes some knowledge, and is targeting PhDs in computer science. :-)