Wednesday, December 26, 2012

Bill's Recommendations - Skitch Screen Annotation Tool

About two month's ago I stumbled upon a neat app called Skitch. Skitch is a screen capture & annotation app that works on Windows, Android, and iOS platforms and is part of the Evernote family of products. My experience with this app so far has been great and it has saved a lot of time. I have been able to create rather professional looking documentation & troubleshooting aides for clients. My favorite feature is the ability to draw annotations on the captured images which comes in handy when explaining something visually as seen here:

As a added feature, there's an option to export the captured image directly to your Evernote account! The best part in my opinion about this app is that the user interface & tools are the same on each platform, with added tools for smart phones. For example, you can take a photo with your smart phone, open it in Skitch, annotate and share the picture with colleagues or clients. Maps & websites can also be captured and edited with smart phone version. All around this app has a lot of usefulness and is a worthy addition to any productivity tools you may currently use. I strongly recommend this app.

Wednesday, September 19, 2012

Changing Screen Resolution with Powershell

It's been a while since I have had time to post anything of interest to me but I wanted to share a little bit of information I stumbled across a few days ago. The situation required a log on script to change screen resolution to a pre-defined size. How would I accomplish this task without using a program like qres or reso and make a script to do it?

I like PowerShell scripts because it seems to do just about anything on a Windows pc. After a short search I turned towards a resource that has been a great resource in my personal PowerShell journey, Microsoft's "Hey, Scripting Guy!" blog & Script Center. I found an interesting article from two years ago asking the very same question I had, with an interesting answer, and a example that at first wasn't clear to me how it worked. I plan to explain it in a way that may help other's still learning PowerShell.

After reading the "Hey, Scripting Guy!" blog entry from July 7th, 2010 I copied and pasted the code into my favorite text editor, notepad++ , and began to analyze the code. What was scripted by Andy Schneider was exactly what I had been looking for!

Here's where I screwed up at first; I didn't catch that the copied code was essentially a custom PowerShell function that needs to be called upon when loaded at the powershell command prompt. If you remove the "Function Set-ScreenResolution" and curly braces from the top and bottom of the script, you will get a simple GUI asking for resolution parameters.

I have outlined the steps below with screenshots to create a PowerShell script that calls this custom function and based on your input, will change your screen resolution.

1. Create a folder in a location of your choosing and call it "ScreenResolution" or whatever you choose.
2. Using your favorite PowerShell editor (I used both notepad++ and PowerShell ISE), copy and paste the code example from Andy Schneider listed in the above "Hey, Scripting Guy!" post from July 7th, 2010 into your new .ps1 file. Save this function as "Set-ScreenResolution.ps1" .
3. Open a new tab in your powershell editor, and use my example PowerShell script below:

Save this script. I chose 1024x768.ps1 to identify the resolution the script would set as my resolution.
*Notice the . before the path to our function. This loads the function before executing the command with parameters. This is where I had some trouble at first, thought I would note it. For more information on Functions, here's a good start:
4. Open a PowerShell prompt and cd to your folder location. In my example, I chose C:\ScreenResolution\.

All that's left is to type in the name of your resolution PowerShell script containing your set parameters and voila! screen resolution changes! You can also right click on the script and choose "Run with PowerShell".

I hope this helps those like me who are not programmers but enjoy learning and using PowerShell. I would also like to say thank you to the whole "Hey, Scripting Guy!" team for the original blog post about this topic.

Wednesday, March 7, 2012

Bill's Recommendations: WinMerge

In an earlier post I spoke about how a little utility called WinMerge really saved me a lot of time comparing some folders related to a project I had undertaken. I decided to write a little more about this little gem and how I have incorporated it into my toolkit and started using it on a daily basis.

WinMerg is a file & folder merge and differences tool that is cross platform, working on both Windows & Linux OS. It is even available as a portable app. It also has a very intuitive interface using easy to understand visuals.

My experience with this software has been very pleasant. I was able to install the software rather quickly, both in the portable format and for Windows. The folder comparison was rather quick and allow for the ability to generate a report. Overall the interface is very easy to understand just like their site says. The documentation is also very sufficient.

My favorite part about this software is that it is FREE & OPEN SOURCE!

So far I have used it to do directory comparisons, word documents, text files (logs), and single folder comparisons. This tool has been very accurate each time I have used it and it has earned a permanent spot in my toolkit. I highly recommend this software for anyone needing to do some accurate file and folder comparisons.

Download WinMerge Here.

My Foray in Moving Disabled AD Accounts & Home Folder Directories Part 2

Last Friday I began with my plan to move users home folders from an old server to a new server. After doing the needed research on Friday and having successful tests the plan proceeded to be executed. below is the first line of code I used on the old server using robocopy:

|  robocopy \\oldserver\home\  \\newserver\home\ /S /E /COPY:DATSOU /R:1 /W:30 >C:\HomeDir_robocopy.log  |

The above robocopy command moved all home folder directories to the new server while retaining the ACL's. This process took about 1 hour to move 22GB's worth of files over the network while creating a log as well. I am sure I could have added more threads to this command using the /MT: switch, but I didn't. Live and learn.

After this process completed, I went through and checked the log file that was created to verify that all files were copied and that there were not any errors. No errors were logged, and the ACL's matched up. I consider that a great success. \\oldserver\home share was then removed from the available shares on the Windows 2008 server. No more old server home folder access for users. The folders are still on the server for the next couple of weeks in case a user is missing any files or cannot access their new home path.

Then the fun part began. I then used a powershell command to look through the Student OU and change all user objects home path to point to \\newserver\home\%username% with the following code:

|   get-qaduser -searchroot 'ou=youraccounts,dc=yourdomain,dc=com' | foreach-object {$folder = $_.samaccountname;set-qaduser $_.dn -homedirectory "\\yourserver\path\$folder" -homedrive 'M:'}   |

The above cmdlet is used after installing the Quest Active Roles AD Management PSSnapin. This cmdlet searches the OU specified in the domain and sets the homedirectory attribute to the path & drive letter that you specify. With all user's now using the proper home path all I needed to do was sit back and wait for someone to scream. So far, no one has complained and all seems to be working pretty smoothly after this move.

Overall this project was a great success and allowed my customer to start planning to allow this server to finally be decommissioned after a long waiting period resulting from this problem of duplicated home folders that were also not mapped properly and a need for ADUC cleaning. This server is now on it's way to becoming and RODC for a satellite office.

Sunday, February 26, 2012

My Foray in Moving Disabled AD Accounts & Home Folder Directories Part 1

It's been a while since I have posted anything but I wanted to write about a little issue I recently worked on and had some success in performing. There may have been other ways to do this more effectively, but I could not find any sources that would apply to this particular situation. After about a month of research, trial and error, I found one solution that did fit my particular situation and it was a proverbial "one-liner" worth of code that I would like to share. But first, let me explain this situation and how I was able to use Powershell to work on the issue. This will be one of a couple of planned posts in the comming weeks/months.

A client I am working for has a large Active Directory user base and every user has been assigned a home directory for personal network storage. A year or so ago this client added another server and started adding any new user object's home directory path to the new \Home directory path. There were still quite a few user objects that were residing on the old server's \Home directory that needed to be transferred to the new server. Here's where the issue begins. Before I started working for this client, a file migration was attempted and failed to the point where the whole project was put on hold. The worst part of it was that the home directories that were transferred to the new server in the first failed attempt were never cleaned up, thus making it appear that directories were moved and resulting in duplicate data with the recently moved directories missing the original ACL's assigned to each.

Here was my first mission. Perform cleanup for future move of remaining active user object \Home folder directories from old server to new server.

Step 1) Remove duplicated files from new server \Home directory for Active Directory Users 
Before I start, I need to remove as much garbage as possible to allow for that extra space to be available for future use in this project. I utilized WinMerge to perform a directory comparison, giving me accurate time stamps, filtering and the ability to delete folders that were duplicated. Great utility, and I strongly recommend it for doing file comparisons. After doing this comparison, I was successful in removing about 16GB worth of duplicated files on the new server and now both directories are clean again.

Step 2) Find inactive Active Directory User Objects
This was a simple task. I first created a custom saved query using Active Directory Users & Computers Microsoft Management Console (MMC). After creating my custom console I also added the Advanced Features view. My first query was configured to display all user objects that had not logged in during the past 180 days (6 months) on the OU container for the user base I was working with. This query returned over 485 objects! With a quick CTRL+A I selected all the user objects and disabled the accounts, then moved them to a new OU I created called Disabled Accounts. AD is now a little cleaner.

Step 3) Find Disabled User Objects and Move Objects' Home Directory to Alternate Location
Here's the part that involved lots of research and testing. I wanted to use a Powershell script to accomplish this task because I am learning Powershell. I was also looking for a code example that would be easy to implement and was not real complex but could be slightly modified for future use. My original plans included such tools as RoboCopy , VB script, and Powershell. I settled on this Powershell cmdlet that I found on Big THANK YOU! to Shay Levy and his reply to a post I found there. His code was an excellent example of what I was looking for. After obtaining the required free Active Roles PSSnapin from Quest Software I was able to execute this line of code with my attributes to successfully scanned and moved almost all 485 user object \Home directories to a temporary archive folder on the old server. It even found some of the disabled accounts that did not have home folders specified since the disabled user never logged in, returning an error but continuing. I tried to move the files to a NAS unit but Powershell returned an error stating that the files could not be moved across volumes. The best part was that the folder ACL's did not change.

My next post will be about how I moved those folders to a NAS using RoboCopy (if the client decides to keep them that is) and how I move the remaining \Home folders to the new server while retaining the ACL's.