So for some reason or another, within the last day, my powershell profile has vanished. Fortunately for me, I DIDN’T HAVE MY PROFILE BACKED UP. Son of a ^&%(*&^.

After some much needed cursing, there was really nothing to do except make a new profile. However I refuse to have this new profile disappear on me again. So I decided to throw a line into my profile so it would back itself up.

IF((get-date).dayofweek -like “Monday”){copy-item $profile “C:\power\profile\$(get-date -format yyyyMMdd)profile.ps1”}

Pretty simple enough. According to this line if you open powershell on a Monday, it will copy and date the profile to the directory I listed.

For example If I open powershell on Monday August 27 2012, it will copy and rename the profile to C:\Power\Profile\20120827profile.ps1.

Yes, if I don’t go in there an clean it out that profile folder could get quite a lot of copies of my profile in it. Even checking/cleaning out the folder once a year though, there would only be 52 copies in there, and they don’t take up a lot of space so I am not too worried about it.

Besides at this point I would rather have too many profiles, then have to start over again… šŸ™


Leave a Reply

%d bloggers like this: