Great videos Shane. I'm a senior Web Developer, but a total noob when it comes to PowerShell... Your videos are really clear and concise... I'm looking forward to using PS to improve my builds and workflow... I should have got into this years ago! Good work... Cheers!
Shane, please consider making a video about when to use brackets, double brackets, parenthesis, double parenthesis, comas, semi-colon........it gets confusing for beginners
Shane Young enjoyed another session, so many questions but first let's start with the kudos, after all I can see that some effort was put into this session for such a good presentation. The fact that you don't bash or assume anything about your audience is super user great stuff. I want to drop a bit for the pipeline, I am an old guy, been around for a minute consumed as much data as I could on my ms pursuit, the start-transcript days for me 286, 386, 486, DOS, 3.1, 4.0 days. You get the picture. Almost like the picture show "Castaway" Tom Hanks, where he was on top of his game with Fed Ex, crash landed, fell out of the cloud for a minute. Well I'm that guy and I am meshing the networking together for a back to the future experience. So, great show you made reference to some of the stuff like DOS to powershell, how much of the old tech scraps are still in viable use? What would be a fast track to fill in the nuggets approach would you take and is it possible to use powershell to communicate to onedrive, If so, how? Do you have a complete series of the Vids?
Hey Rick. I hope you have enjoyed the journey. I never did much with PowerShell and OneDrive. Not sure why. I do have 40 general PowerShell videos but nothing specific. 😑
OMG! this is such a life saver. Thank you so much for this explanation, I'm getting started on my studies in computer science and I was looking for video that I could understand on how to go about using PowerShell and this is yet the best one. I love it. Ill most defiantly be using your videos to come back and understand whatever is being thought at school.
This may sound odd, but you sound A LOT like Charlie Kelly from It's Always Sunny in Philadelphia. I love it cause it makes me feel like I'm being taught by an old friend and it's a lot of fun! Anyway, thanks for the great video!
hi Shane, thank you for sharing your knowledge with all of us. most appreciated, and i hope and wish you folks are doing good. i request you to share a tutorial about information on working with remote computers when trying to copy a folder from a local machine to multiple target servers. i am a bit confused about how to pass on the remote directory variable.
here's a beast of a task for you Shane, i am trying to create a powershell script which connects to a table in a database, the table contains 3 columns, filename, sourcepath and destination path, the powershell script reads these values from the table(stores them in an array perhaps?). It reads the sourcepath (folder location), it goes to the source folder and depending on the filename it determines the destination(folder location) it is moved into, all the while writing to a log table and capturing the errors. There's a lesson video for you. cheers.
Hey Shane your videos shares good info, Can you provide the solution or your views on the below - Step 1: Delete the folder A from drive D. Step 2: Copy the folder B from Drive C to Drive D. Step 3: After copying the folder from Drive C to Drive D, compare the size of the folder B in Drive D and folder B in Drive (To ensure the complete file moves or not, size of file will be GB or TB). Step 4: Delete the folder B from Drive C.
Are you able to delete all of a certain file extension based on the creation date and older? So all files with .docx 3months or older delete in all subdirectories.
Thank you Shane..its really helpful video. I have a quick question i want to put a filter to move oldest folder only and once it move it must have the same name at the destination..
Hi Shane, great video and tips. I am a total novice and have been given a task to copy files from a non-internet environment through the firewall on to the business domain. I have a firewall rule in place to go through any ideas?
Great vid but I got a question: Is there a way to open a file straight from powershell? For example, you listed doc1, doc2, excel etc. Is there a command where you can open doc1 without needed to move the mouse over to file explorer? Thanks
I thought so but I haven’t done it in a while but I think if you just pass the file name it will treat the file with the default behavior for that file type. But now I am not sure. 😑
Hi Shane. I have drive E(1TB) and drive F(8TB). Need to write an script to do this : read E and look if the file is already at F. If yes, write a .txt file in drive C with the folder\filename in E and the folder\filename in F. If not in F, copy file from E to F keeping same directory structure and write to above .txt folder\filename in E and the folder\filename in F. Continue till all drive E has been explored. My problem is that some years ago I copy many files from E to F but I distributed those in different folders at drive F, so I can not use an standard backup tool because they are designed to look for same structure in both source and destination drives. Do you have an script to do what I want?
Sorry Shane hit wrong position on keyboard and sent previous message unfinished. Is it possible to write a script to start 'Start Transcript' automatically? Thanks for your patience.
if i use get-childitem - recurse and remove-item to remove files and folders I get the path to long exception. Do you know of any easy way to handle that? (Forcing the command did not end up deleting the files/folders)
What is the best way to reliably delete a file that is in use by a process? It's on a file server and I need to delete the generated report daily but some process is still hanging onto it and not allowing me to delete like I can other files in that same folder. Help!
@@ShanesCows thanks for the reply! I did figure it out after an hour or so. I was trying to delete a file after emailing it as an attachment with System.Net.Mail.MailMessage(). I had to use the .Dispose() method on each attachment object then I could delete the file. If I tried to delete the file before using that method, it would just say file was currently being used by another process.
Hi Shane I'm having trouble finding the folder to access. What files will work with this. Can I move stuff from my documents folder to my desktop. I can't get it to pull up a y of the folders I try. Thanks for your help. Keep up the videos is slow learning for me but I'm trying to learn shell thanks
Hi Shane, thank you for your videos, they are very clear and easy to follow. I have heard that with PS6.0 it is possible to download web pages using WebRequest. I am interested in experimenting with scraping websites using PS, is it possible that you could do a video on this subject. It would be truly awesome if you could. Thank you again.
Shane Young Thanks for considering my opinion . I didn't understand clearly on | Get-Member on objects & property if their is any blog created by you let me know
Shane, do you have a PowerShell script handy that shows how to MOVE a FOLDER and all of its contents from ONE Library to a DIFFERENT Library in a SharePoint Online site when the value of a field changes ?
Thanks it help me lot to learn this but i have a problem in coping folder when I have copy a folder one location to another location there was a error file path is too long I have tried so many solution but it helpless. Is there is any power-shell command to avoid file path is too long error.. Plz help.?
Great explanation on Copying, Moving and Deleting Files!!! How do I write in PowerShell before copying the files over, to check if the files already exist in the folder "DONT COPY THEM"? How do I use "IF Statement" with that? I would like to check the destination folder first if it has the files already instead overwriting them. Any Thoughts? Thank you very much for the great videos!!!
Use Get-ChildItem YourNewFile.docx to try to get the file before you write it. If Get-Childitem is blank then you know it is safe to write the file. If Get-ChildItem returns a file then you know you want to show your error and not write the file.
Hi Shane. I was using get item and get childitem on my desktop. What I dont understand is there are clearly file in there however it wont be shown. Is there a particular reason for that.
Hey Shane! you´re awesome! maybe you can post in the near future the video you talked about copying/moving SPO files with metadata, please please please, then I will owe you the best cup of coffee, Greetings from Costa Rica!
:) I do need to do that video. It is just so ugly. Let me look at my notes and see what I got. Tell you what, email me and I will send you the pieces so at least you can play with them while I think about how to make it an actual video.
that´ll be great! email account sent I´ll be by Florida on Aug 4th so if you give me a shipping email address I´ll be honoring my word about the coffee. just let me know grind or grain. Let´s pray US customs don't confiscate it hahaha
Hi shane, i want to copy files one server to another server using power shell script it is working, but when we scheduling task in task scheduler nothing is happen showing message task completed but i am unable to found any file on another server. Copy-Item "C:\xyz.html" -Destination "\\DC01\g$\Snapshot",here is this command...plz check & confirm...why this script not working in task scheduler or help me something else...
This was great and right on with what i need to know, but i have a question. i want to write a script that would copy off of a network drive. I can do things like "cd N:" and it will go to that drive which is great, but the folder i want to reach is not a drive that is mapped to the users.. so when i look at the address it reads like this.. \\server\Shared\Private\Database\ when i do something like "cd \\server\Shared\Private\Database" it doesn't know what the location is. Some answer to this? I think what you're showing me is 90% of what i need to know.. basically i just want to make a script that would grab a file in a network folder and paste them on the individuals desktop when they run the script. It's an access database used by many and they can't (shouldn't) run the original copy on the drive.. so we have them manually copy over a db file locally to make changes without people stepping on each others toes. However we often make fixes / updates to it so I was thinking of making the manual process automatic..
Hi Shane... I have a rabbit-trail question about copy-item (sort of). I am on a central server... I have a New-PSSsession to a remote machine... I have a PowerShell script that I want to run against said remote machine, so I am doing a Copy-Item of the script to the Session... then I am doing an Invoke-Command to run the script. Then, I was the output from the script to be copied to the central server. If I am creating a persistent PSSession and doing an Invoke-Command, isn't the Invoke-Command already doing the Copy-Item? And, am I really copying the PSscript to the remote machine or am I running the command in the persistent PSSession? Great video series btw...!
Hi Shane, this was again a great video especially for someone that is learning powershell, is it possible to create a video on how to get a download link from a file that is stored on your onedrive folder and sent this link by mail to your client? that would really awesome if you could do this. thanks in advance.
Thanks Paul. In theory all of the pieces are there but I haven't tried to do exactly what you are asking. I would look at the properties of the file and see if you get the URL you need, I am sure you do, and then you can use Send-MailMessage to email from PowerShell. Please share if you get it all working. Thanks again - Shane
Shane Young hi Shane, the problem is that I'm a novice on powershell and I try to figure out how to get it done. I know Vba but powershell is new to me. I read that it should be possible to do this by adding the onedrive api to powershell. But further then this I didn't get. So I saw your videos and was wondering if you could help me out. Thanks for taking the time to read this post
I was recursively going through file directories a file server to delete particular files but keep get an error about directory path too long. is there a limit on how long a path can be in PowerShell this seem strange
Yes. Been a while but I know it is possible. What app do you want to open? I think this blog post shows it. www.energizedtech.com/2010/03/quickly-open-files-with-defaul.html
Any ideas on removing files with specific characters in the file name? Have old photos that are named odd123.jpg and odd123 (2).jpg. Both the same image so I want to remove the (2).jpg files but not the original.
if I create a random number and make it in an array$random = @(get-random -Minimum 0 -Maximum 50) like this how can I check how big the array is if the number come out like 1 character or like 23
I am sorry, I don't follow your question. :( If i run: $random = @(get-random -Minimum 0 -Maximum 50) I just get one number stored in the $random variable.
Great video. Do you have any example on how to rename and organize non persistent file names with spaces in random place in a file name? For traditional dos I used "for" to delimit to separate then give each common string to put aside and rid off strings between then organize the file name more legibly. E.g. file names. "file 123 34_7.xlsx" "file 3 rt 34_8.xlsx" to file7.xlsx & file8.xlsx - for this I would use something like: for /f "tokens=1,2*" %f in ('dir/b') do @for /f "delims=_" %j in ('echo %g %h') do @ren "%f %g %h" "%f%j" - this I don't want to use
I have files on different servers, I would like to make a directory with a dynamic name and then copy all the files generated latest date on different server to the newly created dynamic folder, How can I do that with PS script
When opening powershell, it took forever. I had started typing and not seen any input registering until 3 minutes later. Is there anything that might cause this?
I saw a comment on one of your videos that the person liked your style of explaining things; and I have to agree. I've been using PowerShell for a few years now; however, I still watch a lot of videos so I know who and where to point new people to. That said, I would like to ask that you change your font colors. Maybe if you haven't already, do a video on c:\Users\%UserName%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 And cover things like: $Host.UI.RawUI.ForegroundColor="Cyan" $Host.UI.RawUI.BackgroundColor="DarkBlue" $Host.PrivateData.VerboseForegroundColor = "White" $Host.PrivateData.VerboseBackgroundColor = "Blue" Because as it is; your text in the videos is extremely hard to read depending on it being my monitor at work vs my monitor at home. So, I'm sure that if I'm having an issue, someone else is having a difficult time reading what you're typing as well, especially quoted text for strings and such.
Thanks for the feedback. I do need to cover the profile stuff, and yeah I try to go with larger sizes to account for the colors. The challenge from my point of view is if I change the colors that is one more thing for a newbie to deal with not looking like their screen. That is why I have stayed default thus far. But you are right quoted text is ugly to read. Pros and Cons. Thanks for watching and I will see what I can come up with.
wonderful tuts dude... however I had a slight challenge, when I created a folder, I couldn't reference it in powershell just like you did with the demo stuff
I found this by creating a new folder on my desktop and doing the same. Because I was checking a local directory instead of a network folder, it just shows up as the path we're used to seeing except with "\\[computer name\[path]" instead of "c:\[path]"
Do you mean like using Rename-Item? Maybe mix that with my video on string manipulation? Give me an example and if I can give you a quick answer happy to share.
If you are a local administration you get to those remove files directly, without any magic, by using \\computername\c$\folder the adminstrator share is a great way to get those one of things. Does that help?
How do you remove a link from a text file like notepad.exe? The link would start from: www. and end with the end domain extension like .com, .net...etc. Thanks I like you videos!
I found something like extract a link from a web site, but now I need to take out some before the links.. I used get-content, and $Content | % { if($_ -match ": http") {write-host $_}} to get links. Now I must remove the following: "href : " from href : websiteurl.com/, any ideas? ;-)
foreach($folder in $folders) {cd $folder.FullName; Remove-Item *.txt;} Is this the correct way of iterating through all sub folders and deleting text files inside those sub folders? It works, but just wanted to know the right approach. Thanks.
get-childitem -Include *.txt -Recurse | Remove-Item That is what I came up with quickly. You should test it and there still might be better ways but that should work.
You would just need to work on your Get-ChildItem to only return the old items. This blog post should help. blogs.technet.microsoft.com/heyscriptingguy/2014/02/07/use-powershell-to-find-files-that-have-not-been-accessed/
Hey Shane - lovely videos as I am starting to have fun with PS. I am currently struggling with two problem and it would be great if you help me with the codes : 1. I want to set a encrypt a folder (and the files within) with a password for data protection 2. I want to change the file-creation and modify dates for a particular file - for this when I am giving the path, PS is returning an error "position parameter"....not able to work around that. Is there a specific way to provide the path, if it is something like c:\users ila9\downloads\academic books\coding\xxxx.pdf [the position is error is occurring at the "academic books" part. Is that because of the space in the name of the folder? Thanks a lot
I'm completely new to ps, and your comment is a yr old, but maybe you're encrypting the files prior to manipulation further down the script? In your scenario, I'd try restructuring the order of events. Create the directory, move the files in, then reorganize as necessary, then encrypt/decrypt using a try catch with read-host -name (password) so if the password entered is correct, the path is decrypted, else an error is logged, and the script is thrown. 🤷🏻♂️
It's like a ghost file. It was broken when I downloaded it. When I go to delete it is says "discovering" but never finds it to delete it. The name of it is very long and it will not allow itself to be renamed or moved. It is on my PC \ downloads \ Ferrari Offset ect The file name has spaces so I dont know if this affects it. But it could not locate the file based on your instructions.
I come from linux, is funny to see powershell in use in windows machines world: much more confusing, much more caotic, and much less eficient and fast than linux terminal shell. I mean is like 1000-10 score... winning Linux of course...
its so frustrating when you watch a tutorial and they forget to mention something so simple as how to navigate to a folder that has spaces in its title. I stopped watching when he just blew past one of the most essential things to know.
@@ShanesCows then you should've said I won't be covering that in this video. I can't copy, move or delete a file if I don't know how to access it. All you literally had to say is put an apostrophe before the space if it has spaces. Plus learn to take criticism it makes you better
Shane, as an absolute rookie to PowerShell, your videos are fantastic, keep them coming
40 more to go :) ua-cam.com/video/IHrGresKu2w/v-deo.html
By far the best powershell training video on youtube! Very clear and understandable. Hats off to Shane!
You are too kind. Thank you.
Great videos Shane. I'm a senior Web Developer, but a total noob when it comes to PowerShell... Your videos are really clear and concise... I'm looking forward to using PS to improve my builds and workflow... I should have got into this years ago! Good work... Cheers!
Shane, please consider making a video about when to use brackets, double brackets, parenthesis, double parenthesis, comas, semi-colon........it gets confusing for beginners
I second this!
Please tell me this was picked up😭
Please!
Another great tutorial. The length and complexity was just right for me. Thanks.
Glad to help. 😀
Hey Shane Thank you am a pentester, your videos are priceless!! i can now navigate through windows systems. am from unix based terminals.
Very cool. 😎
Shane Young enjoyed another session, so many questions but first let's start with the kudos, after all I can see that some effort was put into this session for such a good presentation. The fact that you don't bash or assume anything about your audience is super user great stuff. I want to drop a bit for the pipeline, I am an old guy, been around for a minute consumed as much data as I could on my ms pursuit, the start-transcript days for me 286, 386, 486, DOS, 3.1, 4.0 days. You get the picture. Almost like the picture show "Castaway" Tom Hanks, where he was on top of his game with Fed Ex, crash landed, fell out of the cloud for a minute. Well I'm that guy and I am meshing the networking together for a back to the future experience. So, great show you made reference to some of the stuff like DOS to powershell, how much of the old tech scraps are still in viable use? What would be a fast track to fill in the nuggets approach would you take and is it possible to use powershell to communicate to onedrive, If so, how? Do you have a complete series of the Vids?
Hey Rick. I hope you have enjoyed the journey. I never did much with PowerShell and OneDrive. Not sure why. I do have 40 general PowerShell videos but nothing specific. 😑
Thanks Shane. In particular for the remove-item with a * at the end. Helped me delete all subfolders using -recurse -force
Loving this PS series. Very informative and easy to follow, I appreciate your hard work!
Glad you enjoy it! Have a good day Andrew.
Remember the old DOS NORTON COMMANDER? I loved that Directory/File management system back in the day!
Awesome!
OMG! this is such a life saver. Thank you so much for this explanation, I'm getting started on my studies in computer science and I was looking for video that I could understand on how to go about using PowerShell and this is yet the best one. I love it. Ill most defiantly be using your videos to come back and understand whatever is being thought at school.
Glad to help. 😀
@@ShanesCows also Shane ,you can type GCI instead of get-childitem if you don't want to type the whole thing
Thanks, Shane I've really enjoyed and found useful the series so far.
Cool. 😎
how the hell do i delete powershell in windows 7
This may sound odd, but you sound A LOT like Charlie Kelly from It's Always Sunny in Philadelphia. I love it cause it makes me feel like I'm being taught by an old friend and it's a lot of fun! Anyway, thanks for the great video!
Love that! A few people have mentioned that along the way. Have a great day!
this is just wonderful! thank you very much, Shane!!! just what I was looking for.
Awesome!
Thank you for the video. You have a great talent to teach! Have a wonderful day!
Thank you 🙏
@shane how did u paste the path of demo 2 folder? and how did u get the path by CLICK in the command line at video duration from 7:40 to 7:46
Turn on Quick Edit in PowerShell
hi Shane, thank you for sharing your knowledge with all of us. most appreciated, and i hope and wish you folks are doing good.
i request you to share a tutorial about information on working with remote computers when trying to copy a folder from a local machine to multiple target servers. i am a bit confused about how to pass on the remote directory variable.
Sorry I haven’t done much with remote computera
Shane Young , thank you for reverting, I finally managed to create correct variable and now have a script to copy a folder to multiple computers
start-transcript alone is very useful especially for new users who may have done something good but forget how they did it
Agreed!
here's a beast of a task for you Shane, i am trying to create a powershell script which connects to a table in a database, the table contains 3 columns, filename, sourcepath and destination path, the powershell script reads these values from the table(stores them in an array perhaps?). It reads the sourcepath (folder location), it goes to the source folder and depending on the filename it determines the destination(folder location) it is moved into, all the while writing to a log table and capturing the errors. There's a lesson video for you. cheers.
What have you tried this far?
Amazing video ...Thanks a lot Shane
Could you make a video to automate AutoCAD or any programs with PowerShell?
Thanks for the video Shane! I tried to do the copy-item with -recurse, but it doesn't work. The newer file copied over the old file. Any suggestions?
Not sure. Sorry.
Hey Shane your videos shares good info, Can you provide the solution or your views on the below -
Step 1: Delete the folder A from drive D.
Step 2: Copy the folder B from Drive C to Drive D.
Step 3: After copying the folder from Drive C to Drive D, compare the size of the folder B in Drive D and folder B in Drive (To ensure the complete file moves or not, size of file will be GB or TB).
Step 4: Delete the folder B from Drive C.
Yikes. What have you tried?
Very informative videos.. any video on copying file with permission or working with share and NTFS permissions using powershell?
I don’t. Never had to get into permissions. Sorry.
clear knowledge and useful ! I love you, awesome guy, fantastic video!
Thanks again 😍
Are you able to delete all of a certain file extension based on the creation date and older? So all files with .docx 3months or older delete in all subdirectories.
Yes. You would need to write a filter that returns the items you want and then pass those objects to the delete.
Quite a useful video. Could you say about get-help at the beginning?
My video learn PowerShell covers get-help
Can you please share video of different ways of exporting the outputs in excel,word etc.,
Thank you Shane..its really helpful video. I have a quick question i want to put a filter to move oldest folder only and once it move it must have the same name at the destination..
What have you tried?
I learn about the move item command from the video so far. But not sure how to add the filters.
Hi Shane, great video. Im new to PS and it defn helps. How do i copy folders with spaces
Not sure. Sorry. But try using ‘ around the path.
im not a sys admin...
but you have gained my sub!
Thanks. Hope I can live up to the pressure of keeping you around. :)
Shane Young luckly im actually not a very picky person xD just really ethusiastic about pcs
Hi Shane, great video and tips. I am a total novice and have been given a task to copy files from a non-internet environment through the firewall on to the business domain. I have a firewall rule in place to go through any ideas?
Can you map a drive to the Internet spot?
Shane great videos , any chance of videos of working with excel files workbooks etc instead csv files. And can PS create graphs from objects
I have never done Excel. I hear it is a pain in the butt. 😎
Shane Young thanks hence the need for help. ... how about creating your own modules..
I built one module but never did a video on it. It is on the list but deep. Sorry. I am no help
Like the vids. Can you do a Powershell one as it pertains to SCCM?
That would be great but I have not used sccm in years. Sorry
Another great video!!
Очень полезноы видео делает автор канала. Спасибо за этот контент! :)
Нужно больше видео по powershell! :)
Sorry I don’t speak the language
He says it’s a very useful video and thanks you for it, it’s a very great video on PowerShell.
so if you are redoing cmd scripts
to powershell
is there a translation table
I have bash unix alread
Get-alias should help
Great vid but I got a question:
Is there a way to open a file straight from powershell?
For example, you listed doc1, doc2, excel etc.
Is there a command where you can open doc1 without needed to move the mouse over to file explorer?
Thanks
I thought so but I haven’t done it in a while but I think if you just pass the file name it will treat the file with the default behavior for that file type. But now I am not sure. 😑
Hi Shane. I have drive E(1TB) and drive F(8TB). Need to write an script to do this : read E and look if the file is already at F. If yes, write a .txt file in drive C with the folder\filename in E and the folder\filename in F. If not in F, copy file from E to F keeping same directory structure and write to above .txt folder\filename in E and the folder\filename in F. Continue till all drive E has been explored. My problem is that some years ago I copy many files from E to F but I distributed those in different folders at drive F, so I can not use an standard backup tool because they are designed to look for same structure in both source and destination drives. Do you have an script to do what I want?
Sorry, I haven't done anything close to that in years.
Sorry Shane hit wrong position on keyboard and sent previous message unfinished. Is it possible to write a script to start 'Start Transcript' automatically? Thanks for your patience.
John this video. Put it I. Your profile ua-cam.com/video/jQzgSxetr5I/v-deo.html
Hey shane I need some quick help-reply here about PowerShell I just need to know how to change the powershell location
Set-location
if i use get-childitem - recurse and remove-item to remove files and folders I get the path to long exception.
Do you know of any easy way to handle that? (Forcing the command did not end up deleting the files/folders)
Sorry, it has been a long time since I have played with that stuff, I am no help. :(
What is the best way to reliably delete a file that is in use by a process? It's on a file server and I need to delete the generated report daily but some process is still hanging onto it and not allowing me to delete like I can other files in that same folder. Help!
I am not sure, sorry
@@ShanesCows thanks for the reply! I did figure it out after an hour or so. I was trying to delete a file after emailing it as an attachment with System.Net.Mail.MailMessage(). I had to use the .Dispose() method on each attachment object then I could delete the file. If I tried to delete the file before using that method, it would just say file was currently being used by another process.
Hey Shane, how would you find out the number of pages from those documents? Without having to open them?
Not sure. Sorry
Hi Shane I'm having trouble finding the folder to access. What files will work with this. Can I move stuff from my documents folder to my desktop. I can't get it to pull up a y of the folders I try. Thanks for your help. Keep up the videos is slow learning for me but I'm trying to learn shell thanks
Ben yes, you can. What path are you trying? C:\users\shane\desktop?
@@ShanesCows I did it the same way u did in the video using my documents and a another folder on my desktop . But neither one would work.
Maybe the files aren’t really on the desktop. Try a simple folder first like c:\ demo and see if you can get that to work.
@@ShanesCows I have a folder on desktop but I'm not sure. I will keep trying. I will try it with another file thank you .
Hi Shane, thank you for your videos, they are very clear and easy to follow. I have heard that with PS6.0 it is possible to download web pages using WebRequest. I am interested in experimenting with scraping websites using PS, is it possible that you could do a video on this subject. It would be truly awesome if you could.
Thank you again.
I will see if I can add it to the list.
Please add topic on creation pf Array,Hash,Functions And on Registry.
Sound like great ideas. I will add them to my list. Thank you.
Shane Young Thanks for considering my opinion . I didn't understand clearly on | Get-Member on objects & property if their is any blog created by you let me know
Shane, do you have a PowerShell script handy that shows how to MOVE a FOLDER and all of its contents from ONE Library to a DIFFERENT Library in a SharePoint Online site when the value of a field changes ?
Check out this video. Should at least get you moving in the right direction. ua-cam.com/video/xwKTFfhQWLY/v-deo.html
Thanks it help me lot to learn this but i have a problem in coping folder when I have copy a folder one location to another location there was a error file path is too long I have tried so many solution but it helpless. Is there is any power-shell command to avoid file path is too long error.. Plz help.?
I haven’t ran into that before but I am going to guess you are going to have to find a way to shorten the path. 😑
very, very, very helpful. Thank you.
Great explanation on Copying, Moving and Deleting Files!!!
How do I write in PowerShell before copying the files over, to check if the files already exist in the folder "DONT COPY THEM"?
How do I use "IF Statement" with that? I would like to check the destination folder first if it has the files already instead overwriting them. Any Thoughts?
Thank you very much for the great videos!!!
Use Get-ChildItem YourNewFile.docx to try to get the file before you write it. If Get-Childitem is blank then you know it is safe to write the file. If Get-ChildItem returns a file then you know you want to show your error and not write the file.
Thank you
Hi Shane. I was using get item and get childitem on my desktop. What I dont understand is there are clearly file in there however it wont be shown. Is there a particular reason for that.
Hey Shane! you´re awesome! maybe you can post in the near future the video you talked about copying/moving SPO files with metadata, please please please, then I will owe you the best cup of coffee, Greetings from Costa Rica!
:) I do need to do that video. It is just so ugly. Let me look at my notes and see what I got. Tell you what, email me and I will send you the pieces so at least you can play with them while I think about how to make it an actual video.
that´ll be great! email account sent I´ll be by Florida on Aug 4th so if you give me a shipping email address I´ll be honoring my word about the coffee. just let me know grind or grain. Let´s pray US customs don't confiscate it hahaha
how the hell do i delete powershell in windows 7
Hi shane, i want to copy files one server to another server using power shell script it is working, but when we scheduling task in task scheduler nothing is happen showing message task completed but i am unable to found any file on another server. Copy-Item "C:\xyz.html" -Destination "\\DC01\g$\Snapshot",here is this command...plz check & confirm...why this script not working in task scheduler or help me something else...
Sorry I am not sure.
Hi Shane can powershell be used to send or copy from one server to another server like for ftp ..
It can but I don't have any examples.
This was great and right on with what i need to know, but i have a question. i want to write a script that would copy off of a network drive. I can do things like "cd N:" and it will go to that drive which is great, but the folder i want to reach is not a drive that is mapped to the users.. so when i look at the address it reads like this..
\\server\Shared\Private\Database\
when i do something like "cd \\server\Shared\Private\Database" it doesn't know what the location is. Some answer to this?
I think what you're showing me is 90% of what i need to know.. basically i just want to make a script that would grab a file in a network folder and paste them on the individuals desktop when they run the script.
It's an access database used by many and they can't (shouldn't) run the original copy on the drive.. so we have them manually copy over a db file locally to make changes without people stepping on each others toes. However we often make fixes / updates to it so I was thinking of making the manual process automatic..
There is a way to connect network drives in PowerShell. I forget at the moment but if you search it is possible and then this would be easier b
Hi Shane... I have a rabbit-trail question about copy-item (sort of). I am on a central server... I have a New-PSSsession to a remote machine... I have a PowerShell script that I want to run against said remote machine, so I am doing a Copy-Item of the script to the Session... then I am doing an Invoke-Command to run the script. Then, I was the output from the script to be copied to the central server. If I am creating a persistent PSSession and doing an Invoke-Command, isn't the Invoke-Command already doing the Copy-Item? And, am I really copying the PSscript to the remote machine or am I running the command in the persistent PSSession?
Great video series btw...!
Hey Ed. I haven’t done anything with remote sessions so I am no help here. Sorry.
Hi Shane, this was again a great video especially for someone that is learning powershell, is it possible to create a video on how to get a download link from a file that is stored on your onedrive folder and sent this link by mail to your client?
that would really awesome if you could do this.
thanks in advance.
Thanks Paul. In theory all of the pieces are there but I haven't tried to do exactly what you are asking. I would look at the properties of the file and see if you get the URL you need, I am sure you do, and then you can use Send-MailMessage to email from PowerShell. Please share if you get it all working. Thanks again - Shane
Shane Young hi Shane, the problem is that I'm a novice on powershell and I try to figure out how to get it done. I know Vba but powershell is new to me. I read that it should be possible to do this by adding the onedrive api to powershell. But further then this I didn't get. So I saw your videos and was wondering if you could help me out. Thanks for taking the time to read this post
I was recursively going through file directories a file server to delete particular files but keep get an error about directory path too long. is there a limit on how long a path can be in PowerShell this seem strange
Not sure but wouldn’t surprise if there was.
@@ShanesCows thanks
thank you, you are good teacher
Glad to help. 😀
How do you work with Files based on attributes such as tags, rating and dates?
If they are properties you can use them to filter and such.
how to move selected folders from one folder to another folder
Shane, Is there a way to open a file in an application with PowerShell, Calling an .exe file and going to taskbar FIle and click on Open.
Yes. Been a while but I know it is possible. What app do you want to open? I think this blog post shows it. www.energizedtech.com/2010/03/quickly-open-files-with-defaul.html
how to troubleshoot in powershell?
Noted. Thanks
Hi Shane, this may seem a dumb question as I am an old complete newbie virtually know zilch but I was wandering can you not wtit
Replied to the other comment
Any ideas on removing files with specific characters in the file name? Have old photos that are named odd123.jpg and odd123 (2).jpg. Both the same image so I want to remove the (2).jpg files but not the original.
Worked out what I wanted
get-childitem | Where-Object name -Like '*`(2)*' | ForEach-Object { remove-item -LiteralPath $_.name }
Hi Shane, thank u for doing this video.It is very helpful for me.
nice video Shane
if I create a random number and make it in an array$random = @(get-random -Minimum 0 -Maximum 50) like this how can I check how big the array is if the number come out like 1 character or like 23
I am sorry, I don't follow your question. :( If i run:
$random = @(get-random -Minimum 0 -Maximum 50)
I just get one number stored in the $random variable.
Great video. Do you have any example on how to rename and organize non persistent file names with spaces in random place in a file name? For traditional dos I used "for" to delimit to separate then give each common string to put aside and rid off strings between then organize the file name more legibly. E.g. file names. "file 123 34_7.xlsx" "file 3 rt 34_8.xlsx" to file7.xlsx & file8.xlsx - for this I would use something like: for /f "tokens=1,2*" %f in ('dir/b') do @for /f "delims=_" %j in ('echo %g %h') do @ren "%f %g %h" "%f%j" - this I don't want to use
I have files on different servers, I would like to make a directory with a dynamic name and then copy all the files generated latest date on different server to the newly created dynamic folder, How can I do that with PS script
The pieces are here. Maybe look for the video on string manipulation for some more help.
When opening powershell, it took forever. I had started typing and not seen any input registering until 3 minutes later. Is there anything that might cause this?
Haven’t seen that before. What version of PowerShell do you have? Old pc?
Shane, How would I delete all files larger than 50MB?
Set the filter on get-childitems to filter for items greater than 50 mb then pass that to remove.
I saw a comment on one of your videos that the person liked your style of explaining things; and I have to agree. I've been using PowerShell for a few years now; however, I still watch a lot of videos so I know who and where to point new people to. That said, I would like to ask that you change your font colors.
Maybe if you haven't already, do a video on c:\Users\%UserName%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
And cover things like:
$Host.UI.RawUI.ForegroundColor="Cyan"
$Host.UI.RawUI.BackgroundColor="DarkBlue"
$Host.PrivateData.VerboseForegroundColor = "White"
$Host.PrivateData.VerboseBackgroundColor = "Blue"
Because as it is; your text in the videos is extremely hard to read depending on it being my monitor at work vs my monitor at home. So, I'm sure that if I'm having an issue, someone else is having a difficult time reading what you're typing as well, especially quoted text for strings and such.
Thanks for the feedback. I do need to cover the profile stuff, and yeah I try to go with larger sizes to account for the colors. The challenge from my point of view is if I change the colors that is one more thing for a newbie to deal with not looking like their screen. That is why I have stayed default thus far. But you are right quoted text is ugly to read. Pros and Cons. Thanks for watching and I will see what I can come up with.
@@ernest73 anything on UA-cam by Don Jones, CBT Nuggets, or one of the nearly six hour videos from Microsoft with Jerry Snover.
@@Rood67 John Hammond is pretty good with early basic stuff also I found him last night
Nice Job...I'm using a version of PS inside Atom...
Fun.
wonderful tuts dude... however I had a slight challenge, when I created a folder, I couldn't reference it in powershell just like you did with the demo stuff
What happened? What error message did you get?
How do you get the path " \\DESKTOP-3Q38SP3\demo2" ? Where do you get it?
it's a shared folder, thus "\\DESKTOP-3Q38SP3\" is the root location on the network. demo2 was a folder inside of that location.
Either that, or I'm just as confused as you are.
@@pinkmillk Sorry, how do I find it? I'm totally new in this. 100% Newbie.
@@causap Easiest way is to right click the directory you're looking for, click properties, go to the sharing tab. The network path is what he's using.
I found this by creating a new folder on my desktop and doing the same. Because I was checking a local directory instead of a network folder, it just shows up as the path we're used to seeing except with
"\\[computer name\[path]"
instead of "c:\[path]"
After copying a file using powershell it is being locked by poweeshell any solution
Not sure. I haven’t ran into that before.
How do you rename, delete part of title on multiple files i.e. Videos at the same time
Do you mean like using Rename-Item? Maybe mix that with my video on string manipulation? Give me an example and if I can give you a quick answer happy to share.
How to access and edit files on a remote computer using powershell. OR, get a file from a remote computer so that I can edit and then put it back
If you are a local administration you get to those remove files directly, without any magic, by using \\computername\c$\folder the adminstrator share is a great way to get those one of things. Does that help?
How do you remove a link from a text file like notepad.exe? The link would start from: www. and end with the end domain extension like .com, .net...etc. Thanks I like you videos!
I don’t have the answer handy and I am on my phone not my computer to help you look. It is possible. Let me know if you can’t find it.
I found something like extract a link from a web site, but now I need to take out some before the links.. I used
get-content, and
$Content | % { if($_ -match ": http") {write-host $_}}
to get links. Now I must remove the following:
"href : "
from href : websiteurl.com/, any ideas? ;-)
foreach($folder in $folders) {cd $folder.FullName; Remove-Item *.txt;}
Is this the correct way of iterating through all sub folders and deleting text files inside those sub folders?
It works, but just wanted to know the right approach.
Thanks.
get-childitem -Include *.txt -Recurse | Remove-Item
That is what I came up with quickly. You should test it and there still might be better ways but that should work.
Shane Young great! I will try that out.
Thanks. I will try this out.
Thank you Sir.
Happy to help. Have a great day. 🐶
How do I delete files older than a certain number of days??
You would just need to work on your Get-ChildItem to only return the old items. This blog post should help. blogs.technet.microsoft.com/heyscriptingguy/2014/02/07/use-powershell-to-find-files-that-have-not-been-accessed/
I am trying to open stuff on my this pc desktop. why cant I set location to this pc desktop.
What folder are you navigating to? For me it is CD C:\Users\Shane\Desktop
I figure it out actually. I have a couple more questions regarding powershell. I dont know if it is ok to email you.
Hey Shane - lovely videos as I am starting to have fun with PS. I am currently struggling with two problem and it would be great if you help me with the codes :
1. I want to set a encrypt a folder (and the files within) with a password for data protection
2. I want to change the file-creation and modify dates for a particular file - for this when I am giving the path, PS is returning an error "position parameter"....not able to work around that. Is there a specific way to provide the path, if it is something like c:\users
ila9\downloads\academic books\coding\xxxx.pdf [the position is error is occurring at the "academic books" part. Is that because of the space in the name of the folder?
Thanks a lot
I am not sure Monoj. Sorry
I'm completely new to ps, and your comment is a yr old, but maybe you're encrypting the files prior to manipulation further down the script? In your scenario, I'd try restructuring the order of events. Create the directory, move the files in, then reorganize as necessary, then encrypt/decrypt using a try catch with read-host -name (password) so if the password entered is correct, the path is decrypted, else an error is logged, and the script is thrown. 🤷🏻♂️
Obrigado!
😎
This in no way helped me delete a wav file from my computer. 8 hours straight trying to figure this out.
Why are you struggling to delete a file? What did your code look like?
It's like a ghost file. It was broken when I downloaded it. When I go to delete it is says "discovering" but never finds it to delete it. The name of it is very long and it will not allow itself to be renamed or moved.
It is on my PC \ downloads \ Ferrari Offset ect
The file name has spaces so I dont know if this affects it.
But it could not locate the file based on your instructions.
how the hell do i delete powershell in windows 7
Sorry, never tried.
nice vid
Thanks :)
🙂
🐶
Back to DOS... Console rules now. Microsoft money-maker machine.
intro makes me think of strip club...otherwise great stuff
Thanks. I will leave all of my snarky responses out to avoid getting myself in trouble. :)
I come from linux, is funny to see powershell in use in windows machines world: much more confusing, much more caotic, and much less eficient and fast than linux terminal shell. I mean is like 1000-10 score... winning Linux of course...
I remember when terminals were actually terminals 😂
its so frustrating when you watch a tutorial and they forget to mention something so simple as how to navigate to a folder that has spaces in its title. I stopped watching when he just blew past one of the most essential things to know.
Sorry you didn’t like the video. I have over 40 PowerShell videos and I can’t cover everything in every video. 😐
@@ShanesCows then you should've said I won't be covering that in this video. I can't copy, move or delete a file if I don't know how to access it. All you literally had to say is put an apostrophe before the space if it has spaces. Plus learn to take criticism it makes you better
You funny
dog just tell show how to move files from one directory to another... split all this shit up...
Sorry, easier for me to group the videos like this.
Get rid of the talking head window. It's distracting and adds nothing useful to the tutorial.
Sorry you don't like it. Most viewers do enjoy my ugly face though.