Posts

Showing posts from May, 2013

Force PowerShell scripts to run from C:\scripts

Here is a little tidbit I came up with because I like to be picky about how my scripts run.  It forces a script to relocate itself and run from the C:\Scripts folder.  I usually prefer to place the comments that describe a line on the end of that line.  In this case I had to go below the line. $ErrorActionPreference = "SilentlyContinue" $rand = New-Object System.Random #--------------------[ Create and relocate to C:\scripts ]---------------------- if ( ! ( Test-Path - pathtype Container "C:\Scripts" )){     new-item C:\Scripts - itemType Directory - Force   #--[ Create local scripts folder. } $TargetPath = "C:\Scripts"                               #--[ Where the script "should" live $ScriptFullName = ( $MyInvocation . MyCommand ). Name         #--[ EX: script.ps1 $ScriptFullPath = ( $MyInvocation . MyCommand ). Path       ...

Mommy my desktop icons keep disappearing...

Well it's been a while.  I've since gotten a great new job and am back on my feet.  Busy as all get-out but that's a good thing. I thought I'd post this since even though it was easy to find I had never heard of it before and I expect others will be looking for info on it as well. I've been investigating a bizarre issue with desktop icons that's been plaguing users here at the new job. Here is what I found as well as an associated fix. Info taken from here: https://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/e5b19898-2f3d-4ebc-a539-bbf2d8c75351/ This is the response to a question posed about desktop shortcuts mysteriously disappearing: This is a well-known problem, which as it turns out is actually a kind of twisted "feature" of Windows 7.  Basically, there's a script that Windows 7 runs that regularly checks your desktop shortcuts and if it finds more than 4 of them ...