Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

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!