Saturday, October 4, 2014

Native VHD Boot Windows 10 Tech Preview

Interested in trying out the new Windows 10 tech preview but rather not partition your HDD/SSD? Native VHD boot will be your best bet. Basically you create a VHD, install the OS and boot from the VHD. If you want a better understanding of the concept take a look at this technet article: http://technet.microsoft.com/en-us/library/hh825689.aspx 

Before we begin I do want to add that this is not the only way to do it. In fact this can be done a bunch of different ways using the GUI etc. This was easy for my since I already had the Windows ADK installed and I've used the commands before.

Here are the steps I took to boot Windows 10 from a VHD using Windows 8.1
  1. Download the Windows 10 Tech Preview

  2. Download and Install the Windows ADK from http://www.microsoft.com/en-US/download/details.aspx?id=39982 

  3. Create a VHD using diskpart

    Run command prompt as an administrator and type the following

  4.  create vdisk file="C:\VHDs\Win10Ent.vhdx” type=fixed maximum=40000   
     select vdisk file="C:\VHDs\Win10Ent.vhdx”   
     attach vdisk   
     Create partition primary   
     Assign letter=w   
     format fs=ntfs quick   
     exit  

  5. Mount the Windows 10 ISO

     Powershell  
     Mount-DiskImage -ImagePath "C:\ISOs\Win10Ent.ISO"  

    This will mount the ISO using the next letter available. In my case it was F:

  6. Install Windows 10 to the VHD we created
    I was curious if there was more than one version in the Install.wim.

     C:\>dism /Get-WimInfo /WimFile:"F:/Sources/install.wim"  
     Deployment Image Servicing and Management tool  
     Version: 6.3.9600.17031  
     Details for image : F:/Sources/install.wim  
     Index : 1  
     Name : Windows Technical Preview for Enterprise  
     Description : Windows Technical Preview for Enterprise  
     Size : 13,064,126,543 bytes  
     The operation completed successfully.  
    

  7. Only one version which makes our choice easier. Now let's install Windows 10 to our VHD
     C:\>dism /apply-image /imagefile:"F:/Sources/Install.wim" /Index:1 /ApplyDir:W:\  
     Deployment Image Servicing and Management tool  
     Version: 6.3.9600.17031  
     Applying image  
     [==========================100.0%==========================]  
     The operation completed successfully.  
    

    Once the operation is completed successfully you will notice that if you browse the VHD it will have the directory structure of Windows.

  8. Configuring boot options
    There are 100 different ways to do it but the easiest I found was to run the below command
     bcdboot W:\Windows  
    

    Now run bcdedit /enum to make sure the entry was created
  9. Finally we will need to detach the VHD to prevent any corruption
     diskpart  
     select vdisk file="C:\VHDs\Win10Ent.vhdx"   
     detach vdisk   
     exit  
    

  10. That's it. Now when you reboot you will notice that you can choose Windows Technical Preview. Enjoy!

Sunday, September 28, 2014

Powershell - Copy Group Membership

The other day one of the guys on the helpdesk was tasked with creating a new distribution group that would mirror the membership of an existing group. This normally isn't a problem if the group has 5-10 people but the group he had to copy had over 200 members. As soon as I heard that I knew Powershell was the answer. It took me maybe 5 minutes to write this script and saved a whole lot of time.

I do want to add that we spent an extra 20 minutes troubleshooting because we kept receiving access denied errors. It turns out that when he created the group he added his account (not domain admin) in the managed by field. Running the script under my DA account kept giving me those permission errors. The script only worked after removing his account from the managed by field. I was bit blindsided by that but overall a good learning experience. Anyways below is the script I used.

 $sourceGroup = "SourceGroup Name"  
 $targetGroup = "TargetGroup Name"  
 Get-ADGroupMember -Identity $sourceGroup | foreach {$._SamAccountName} { $varName = $_.SamAccountName ; Add-ADGroupMember -Identity $targetGroup -Members $varName }  

I'm thinking about developing this script so that it can ask for feedback instead of editing the script directly. It would make it friendly to anybody who isn't used to scripting. Stay tuned!

Saturday, June 28, 2014

NetBackup - Listing all clients and their versions

Quick Post -
After sorting through a few old files I found a nice little bash script that I used in the past. I was tasked with updating the NetBackup Linux clients to the most recent version which for me was 7.5. One of the nice features about having the NetBackup master installed on a RHEL server was that I could push client updates to my Linux servers without needing root (or any account) access. The command to do this is update_clients which will need a -ClientList parameter passed as well. As -ClientList suggests it needs a list of clients. To make my life easier for creating a list of clients I used this script to output every client and other details that I used to format and filter the clients I needed. Check it out!


Sunday, June 1, 2014

Compiling Skippy-xd on Fedora 20 / Xfce 4

I'm a pretty big fan of the Xfce desktop environment mainly due to its stability and responsiveness with any type of hardware. I tend to play around with other DE's but I always end up coming back to Xfce because it is dependable. Lately I've been using i3wm but that's a story for another time. Something I would like to see added to Xfce is an Apple Exposé type feature. Meaning a full window task switcher which is already included in some DE's like Gnome 3. I set out to find something similar to Exposé for Xfce but surprisingly didn't find much at all. I stumbled across skippy-xd which seemed to be the only real answer (What about Compiz? I decided it was too many fancy effects that I don't need!). Skippy-xd has been in development since 2004 but passed along to three different developers. Up until recently it didn't seem that there was much work done on it so I'll be expecting bugs. Check out this link of skippy-xd in action. Unfortunately it is only packaged for Debian so Fedora users will have to compile from source. Here is what I did to compile and hotkey skippy-xd in Xfce 4.

  1. Make sure you have the following packages installed:
     yum install giflib, libxcomposite, libxdamage, libxft, libxinerama  
    
  2. Grab skippy-xd source files from git repo
     git clone git://github.com/richardgv/skippy-xd.git  
    
  3. At this point I decided to run "make" in the skippy-xd directory but ran into two errors basically complaining that it could not find two header files. After doing some research I found out that I needed the following two packages installed.
     yum install giflib-devel.x86_64 libjpeg-turbo-devel.x86_64  
    
  4. Run "make" in the skippy-xd directory to compile. There should already be a makefile in the directory so running make alone should work fine.
     make  
    
  5. You will have the compiled binary called skippy-xd. Copy this to /usr/bin/ or a location of your choice.
     cp skippy-xd /usr/bin/  
    
  6. At this point you can bind it to any key you would like. You can do this by launching xfce4-keyboard-settings and configuring a shortcut to launch an application.
     xfce4-keyboard-settings  
    
So far it seems to work okay. I do want to note that their is a known bug with minimized windows and some have provided a work around for it. You'll have to search for it since I haven't had time to do it :).


Thursday, May 29, 2014

NetBackup - Estimating the amount of data to be restored

At work I manage the Symantec NetBackup 7.5 environment (RHEL6.5). Every once in a while I'll get a request to restore some data from tape but what I have noticed is that it is somewhat difficult to tell how much data I will be restoring. NetBackup doesn't seem to have an easy way to show the amount of data that will be restored. I search but couldn't really find anything so if anyone has an easier way I would like to know. Anyways, I decided to take matters into my own hands and craft a quick little script to help me.

These steps are done on a NetBackup Linux master server. If you're using Windows Server well the bash script may not help much but the theory should still be sound. Maybe one day I will port it over to Windows...


  1. Use the bplist command to find all files and folders that you will be restoring. If you have never used it before I'd suggest to check out Symantec's tech note on bplist. In this example I will be using bplist to list all files/folders from a NDMP client.

     bplist -C ndmpclientname -S netbackupmaster -k NDMP-policy -t 19 -b -l -s 02/22/2014 00:00:00 -e 03/01/2014 00:00:00 /vol/DirToRestore > ndmp_bplist  
    


  2. The above command lists files and folders in a format similar to if you were to use the "ls -l" command in the terminal.

    Example:
     drwxrwxrwx 2259   2259       4096 Feb 13 21:37 /vol/DirToRestore/test1  
     drwxrwxrwx 2259   2259       4096 Feb 13 21:37 /vol/DirToRestore/test2  
     -r-xr--r-- 2259   2259       727 Feb 13 21:37 /vol/DirToRestore/File1  
    


  3. At this point you technically have all the file sizes in Bytes, for example, File1 is 727 Bytes. Of course it isn't that easy when you are restoring 100,000 files. You could sit there and start adding all day or just use the below script.

Usage: ./GetTotalSize.sh ndmp_bplist

The above script can be modified to include TB at some point. As a disclaimer I have only used it for UNIX clients. It assumes that column 4 is the size of the file in the bplist output. If for some reason this isn't true than the script will fail. Enjoy!


Wednesday, May 28, 2014

Playing Amazon Prime Instant Video on Fedora 20 / Firefox 29

I'll admit that this isn't exactly Sysadmin related but I wanted to share my experiences on playing Amazon Prime Instant Video on Fedora 20. Due to the lack of support from both Amazon and Adobe linux users are somewhat left to fend for themselves trying to get things to work like Amazon Prime Instant Video which uses flash. Google Chrome has helped out in this aspect with built in flash but the problem still lies in DRM-protected content. Several of these DRM functions have historically been provided by the HAL daemon but HAL has now been deprecated. After searching these are the steps that worked for my Fedora 20 system.

Make sure you have the following installed especially the flash-plugin package.

 yum install flash-plugin nspluginwrapper alsa-plugins-pulseaudio libcurl  

Install the hal-flash package based. You can find more details at here

32bit
 yum install http://sourceforge.net/projects/postinstaller/files/fedora/releases/20/i386/updates/hal-flash-0.2.0rc1-1.fc20.i686.rpm  

64bit
 yum install http://sourceforge.net/projects/postinstaller/files/fedora/releases/20/x86_64/updates/hal-flash-0.2.0rc1-1.fc20.x86_64.rpm  


That's about it! Just make sure you do some of the common sense stuff like reloading firefox etc... 

Anyways here are some links that I found helpful - 
https://ask.fedoraproject.org/en/question/38678/drm-flash-videos/
http://www.if-not-true-then-false.com/2010/install-adobe-flash-player-10-on-fedora-centos-red-hat-rhel/
https://github.com/cshorler/hal-flash