Category - How To

How To: Create an Azure Resource Manager (ARM) template from SCRATCH

I want to introduce you to Neil Gat – he’s a Program Manager on my team and he’s gotten quite good at is writing multi-VM ARM Templates. We were talking a while back about Azure Resource Manager templates and how you can use our QuickStart Template Gallery as a “hacking ground” to learn about the format and function of templates. We’re missing some companion documentation to guide you through these, but it’s evolved into more of a gallery of samples that can be the seed of knowledge you can use to create your own templates for your various projects.

I have been working with the Azure team for 6 months now (wow – that long?) and have had plenty of hallway conversations.  Some topics I can talk about, others I can’t.  These usually end up in my “I should write about that” OneNote file and inevitably get filed away for another time.  This one came up as a challenge from me to him… “What about learning to write a template from SCRATCH”? Can it be done?

Neil decided to take up the challenge and he recorded a quick video on it to share.

What do you think… not a bad introduction to Azure Resource Manager templates, eh?  I’ve got a few more resources to share here on ARM templates:

I hope you find this helpful.If you have suggestions for more of them – just give me a shout in the comments section.

P.S. I’ve been reviewing the posts on here lately and honestly – there have NOT been many text posts at all – most have been supporting my video side of things “Tuesdays with Corey”. I honestly DO like to write, so I’m going to make a conscious effort to kick these posts up more frequently.

 

How to fix Ubuntu network hangs on client Hyper-V

I find I need to run various Linux distros on my work machine for my new job on the Azure Compute team. While I still run Windows 10 as my primary OS (sorry – app compat reasons) – I have installed Hyper-V Client so I can at least switch out to whatever distro I need for the task at hand. Things were working great for the most part, until i left the machine running in the background or for extended periods of time.

Then it started to happen.  The network stack would say it’s up and happy, but nothing was working.  This happened a lot while i was using Ubuntu and I couldn’t figure it out.  After some back and forth with some networking guys and virtualization guys – the following was suggested…

  1. Disable network-manager:  It just doesn’t play well with virtualized NICs and the way most hypervisors work. Sure it’s supposed to make wireless easier and things like that, but it’s not required in a virtualized environment where your network stack isn’t going to be changing on ya.
    • $ sudo systemctl stop NetworkManager.service
    • $ sudo systemctl disable NetworkManager.service
  2. Disable avahi: it seemed to be the main culprit that was causing the freezing / wonkieness of the network stack.
    • $ sudo apt-get purge -y avahi-daemon avahi-utils libavahi-core7 libavahi-gobject0
  3. don’t forget to edit your /etc/network/interfaces file to include the necessary info to enable DHCP on eth0
    • $ sudo -H gedit /etc/network/interfaces
    • edit or put in an eth0 reference I added in the following and saved the file.
      • auto eth0
      • iface eth0 inet dhcp
    • after saving and exiting the file, restart your network
      • sudo /etc/init.d/networking restart
  4. Install the updated virtual kernel, Linux tools and cloud tools (if they aren’t already present).
    • $ sudo apt-get install linux-virtual linux-tools-virtual linux-cloud-tools-virtual

Low and behold – things are now rock solid. I can leave my Ubuntu running all day, switch in and out of the VM without any issues and I know my networking stack will be in a consistent state without having to restart the VM.

Am I missing anything? Anyone else working with Ubuntu (client) inside of a windows client implementation of Hyper-V?

Configure AzureCLI to work with OrgID on Mac / Linux

I looked up from a customer presentation earlier today and saw a sea of “fruit” beacon lights staring at me from the audience. In the past I would have been concerned as I would have had to qualify what works and what doesn’t work with “technology X” or “Service Y” on a non Microsoft platform.

I don’t have to worry about that anymore – things have changed. <phew>

If you are a Microsoft technology person and you want to interact at scale with Azure services, your tool of choice is probably going to be PowerShell with ARM (Azure Resource Manager) templates. If you are a NON-Microsoft technology person, you probably don’t want to spin up a windows VM just to run PowerShell to get stuff done.  You should be using AzureCLI.

But wait – we came across an issue with trying to authenticate against an Azure subscription using a “Microsoft Account” (formerly known as LiveID) like in an MSDN subscription or a Free Trial – things work great from the Azure Portal.  It’s not so great from AzureCLI – it errors out.  Why? You need to use an OrgID, not MSFT account.  There is a link to a generic AzureCLI document which has another LINK on how to setup an OrgID for Mac/Linux.

AzureCLI

While it kinda makes sense – how about a SIMPLER video? I asked my friend Boris Baryshnikov to make one for me (as he uses a Mac and the AzureCLI more than I do). Have a look and solve your authentication issue TODAY.

How To: Delete Windows.Old from an upgraded Windows 10 / Threshold system

Yup – I was wondering why I had disk space issues – turns out I had the same problem I documented in this post, once I upgraded my system from Windows 8.1 Update to Windows 10 Technical Preview (a.k.a. Windows 10).

I had Space Issues and Permissions Issues!

windows.old1

Let’s revisit that post for the quick steps on getting back your space:

Here’s how you do it.

  • Download Junction.EXE from Sysinternals. I extracted and saved it to c:source. You will use this tool to generate a list of all the junctions that have to be removed.
  • create a reference file that lists all the junction points and symbolic links in use by opening up a command prompt, changing into C:source and running

junction.exe –s –q c:windows.old >junctions.txt

  • open up PowerShell ISE administrator rights and RUN the following script to remove all symbolic links and junction points in c:windows.old.

foreach ($line in [System.IO.File]::ReadLines(“c:sourcejunctions.txt”))
{
if ($line -match “^\\”)
{
$file = $line -replace “(: JUNCTION)|(: SYMBOLIC LINK)”,””
& c:sourcejunction.exe -d “$file”
}
}

Now it’s some simple taking of ownership, granting rights and deleting windows.old to get your space back.

  • to take ownership use

takeown /F C:windows.old /R /D Y

  • delete c:windows.old – you now have permissions and ownership.

How much space you get back will change based on your particular situation.  I got back my 6 ish GB…

Get the Windows Server Technical Preview bits

October 1st, 2014 marks the release of the “IT Pro” Focused version of Windows 10 from the client perspective.  I am sure you have seen all the tweets / social media / blog posts / press releases all over the place. As a “Server Hugger”, I’m more interested in the Windows Server Technical Preview – which released the same day. I thought I’d share my experiences of getting ready to evaluate Windows Server TP and what I did to get setup.

  1. If you haven’t already – GO SIGN UP FOR THE WINDOWS 10 TECHNICAL PREVIEW for the Enterprise Client… once you have done that, you can start the DL and prep your administrative workstation.  Like all Administrators – you should be managing your servers REMOTELY using RSAT tools – which are client and server version specific.
  2. Next Up – you will need the Windows Server TP RSAT tools – which you can grab from here. remember – I mentioned above – they are Client and Server specific…
  3. Now for the Bits – Windows Server Technical Preview. Well – at the time of writing, they are trickling out.  The official announcement blog post for Windows Server TP and System Center TP can be found HERE.  From that post:

Windows Server Technical Preview

System Center Technical Preview

But wait – say you don’t want to wait to download – or you want to DO something while you are waiting for the download to finish? Check out the Microsoft Azure Gallery Image that was released today for Windows Server TP.  It’s all setup and ready to deploy!

How? Get yourself setup on a 30 day trial of Azure and create a new VM from gallery – Windows Server Technical Preview, October 2014 is a selectable option in the Windows Server image gallery.

AzureWindowsServerTechnicalPreview

Reminder: These are not final – even for evaluation. Don’t use them in production. Features and capabilities will be evolving over the course of the TP, so don’t take everything you see in the TP as being final if you are evaluating a technology.

Lastly – Here is where I go for all the top level “Things I should be trying out….”  The TechNet Library.  http://technet.microsoft.com/en-us/library/dn765472.aspx

  • What’s New in Active Directory Federation Services. Active Directory Federation Services (AD FS) in Windows Server Technical Preview includes new features that enable you to configure AD FS to authenticate users stored in Lightweight Directory Access Protocol (LDAP) directories. For more information, see Active Directory Federation Services Overview.
  • What’s new for Hyper-V in the Technical Preview. This topic explains the new and changed functionality of the Hyper-V role in Windows Server Technical Preview, Client Hyper-V running on Windows 10 Technical Preview, and Microsoft Hyper-V Server Technical Preview.
  • Windows Defender Overview. Windows Defender is installed and enabled by default in Windows Server Technical Preview, but the user interface for Windows Defender is not installed. However, Windows Defender will update antimalware definitions and protect the computer without the user interface. If you need the user interface for Windows Defender, you can install it after the operating system installation by using the Add Roles and Features Wizard.
  • What’s New in Remote Desktop Services in the Windows Server Technical Preview. For the Windows Server Technical Preview, the Remote Desktop Services team focused on improvements based on customer requests. We added support for OpenGL and OpenCL applications, and added MultiPoint Services as a new role in Windows Server.
  • What’s New in Storage Services in Windows Server Technical Preview. This topic explains the new and changed functionality of Storage Services. An update in storage quality of service now enables you to create storage QoS policies on a Scale-Out File Server and assign them to one or more virtual disks on Hyper-V virtual machines. Storage Replica is a new feature that enables synchronous replication between servers for disaster recovery, as well as stretching of a failover cluster for high availability..
  • What’s New in Failover Clustering in Windows Server Technical Preview. This topic explains the new and changed functionality of Failover Clustering. A Hyper-V or Scale-out File Server failover cluster can now easily be upgraded without any downtime or need to build a new cluster with nodes that are running Windows Server Technical Preview.
  • What’s New in Web Application Proxy. Web Application Proxy now supports preauthentication for applications using the HTTP Basic protocol, wildcards in external URLS of applications, redirection from HTTP to HTTPS, use of pass-through authentication with HTTP applications, publishing of Remote Desktop Gateway apps, a new debug log, propagation of client IP addresses to backend applications, and improvements to the Administrator console.
  • What’s New in Windows PowerShell 5.0. Windows PowerShell 5.0 includes significant new features—including support for developing with classes, and new security features—that extend its use, improve its usability, and allow you to control and manage Windows-based environments more easily and comprehensively. Multiple new features in Windows PowerShell Desired State Configuration (DSC) are also described in this topic.
  • What’s New in Networking in Windows Server Technical Preview. With this topic you can discover information about new networking technologies, such as Network Controller and Generic Routing Encapsulation (GRE) Tunneling, and new features for existing technologies, including IP Address Management (IPAM), DNS, and DHCP.

Go out there, try them out – and PLAY SAFE.

Installing the Windows Azure PowerShell Cmdlets.

I am assuming you have used the online graphical portal a bit and now you want to be more productive and start some rudimentary automation. We don’t expect you do use the portal for everything. For an IT Pro – the logical choice is to use PowerShell and work like an admin from your workstation. Before I go into more depth on all sorts of components and features/capabilities of Windows Azure, let’s prep your workstation for some automation.

Step 1: Download the files.

Head on over to the download page from the Windows Azure site. http://www.windowsazure.com/en-us/downloads/

AzurePowershellDL1

This will kick off the download of the Web Platform Installer. This tool will be available on your system to download the current version as well as all the updates we periodically make to the cmdlets.

Step 2: Use the Web Platform Installer to install cmdlets and dependencies.

It’s not just the cmdlets that will download – it’s also all the dependencies that come down and get updated as well. don’t worry – the Web Platform Installer (WebPI) has you covered for ensuring everything is up to date.

AzurePowershellDL3

Step3: Put the install location into your path

This is optional, but helpful if you will be using the cmdlets a lot. There a a number of ways to do this, but in my opinion, the least invasive way is to update your PATH environment variable with the Azure cmdlets install path.

The cmdlets are installed (by default) in C:Program Files (x86)Microsoft SDKsWindows AzurePowerShellAzure

Pull up your system properties. (I right click on “This PC” or My Computer and choose properties). Click on Advanced System Settings.

AzurePowershellDL4

Click on Environment Variables

AzurePowershellDL5

Update the path statement to include C:Program Files (x86)Microsoft SDKsWindows AzurePowerShellAzure. Don’t forget to go to the end of the line and add a ; before overwriting your path!

AzurePowershellDL6

Close off all your windows with the OK buttons and you are good to go.

Step 4: try it out in PowerShell and PowerShell ISE

Just to make sure – check it out in your PowerShell window and tool of your choice.

AzurePowershellDL7

AzurePowershellDL8

Fairly simple and straight forward – but surprisingly hard to find out how to set it up in the easiest way possible. From now on – this system is ready to go with the Azure PowerShell cmdlets.

Step 5: Simplify Your Settings

When you need to run a command against your Windows Azure subscription, the session will need some settings to be referenced a lot. This means you will get a window pop-up to login to your Microsoft Account or account you are using to manage and interact with your subscription via the portal. To make your life WAY easier – if this is your “management workstation” that you maintain and secure, you can download your Azure Publish Settings file including your management certificate. Trust me – it will make your life easier if you do this.  It’s so simple.

From a PowerShell prompt, type in:

PS C:> Get-AzurePublishSettingsFile

That will require authentication to the Azure Portal in order to create your Settings File.

AzureSettingsFile

It will prompt you to download and save it to a secure location. Change to that location in your PowerShell window and then type in:

PS C:> Import-AzurePublishSettingsFile

If you were not in the proper directory where the file resides, you will need to include the full path and name of the file.

To check if the settings file worked correctly – check what subscription is active in the PowerShell console session by typing in:

PS C:> Get-AzureSubscription

This should respond with details of your subscription, including details on the management certificate which will be valid for one year.

That’s It – You Are DONE!

Step 6: What about Updates?

That’s simple! Periodically run the WebPI utility to ensure there are no updates.

AzurePowershellDL9

Notice the date for Windows Azure PowerShell AND that there is no option to “add” it anymore as it has already been installed.  If updates are available that button will become active once again.

That’s about it – if there was an update, it would come down to the appropriate path that has already been added to the system path and therefore all new PowerShell windows and ISE sessions would automatically be updated with new functionality.

Windows Azure–where do I sign up?

(NOTE 3/11/14: clarification on billing with “spending limits feature” has been added. See italicized text in bullet points for additions)

No seriously – where do I get it?

Do I have to get some sales guy to come and sell it to me? Do I contact a software reseller to sell me a copy? Do I need gobs of cash to be able to try this out?

In short – the answer is NO.

The fastest and simplest way to get started is to get your own free trial.

go to www.windowsazure.com

AzureSignup

I think it is relatively apparent where you go for the Free Trial – but I thought I’d highlight the arrows with more arrows in red.

You’ve got links to a FAQ, a phone number you can call to answer questions and $200 in credit to spend on your trial. I suggest you take a moment to read the FAQ. There are a lot of preconceived notions that are either false or greatly out of date with regards to signing up for a free trial. I’ll highlight a couple below:

  • You can use the $200 to try out any number of services without restriction (except the $200 credit limit or 30 days – whichever comes first).
  • The trial is absolutely FREE – you will not be charged for anything above and beyond the $200 credit.
    • MYTHBUSTER: we do not charge you for overages or “mistakes” you make during this trial because you are unfamiliar with how billing works and you are in  a “learning phase”.  In the past we did not have a “cap” that could be added to protect early adopters from getting bills they didn’t expect.
  • CreditCard and Microsoft Account are required.
    • MYTHBUSTER: as mentioned above – we do not charge your card for this free trial.  You are welcome to use your business or personal card – they are used for identification purposes only.  I mean – come on- we don’t want people spinning up services and VMs to do BitcoinMining things without knowing who they are.
  • If you exceed the $200 credit limit on this trial or hit 30 days, the services and account will be automatically suspended.  You are welcome to convert the trial into a simple “Pay-As-You-go” option to maintain your services and will be billed accordingly for services use.
    • The Spending Limit feature is targeted to the MSDN and Partner Cloud network members. It is not available on the Pay-As-You-Go or consumption plans. It was designed to ensure these members won’t get billed while they are developing solutions on the Azure Platform.
    • You are able to sign up for Billing Alerts to warn you when you are approaching thresholds and want to proactively scale back before incurring charges. See this article for more details.
  • Azure Free Trials are available in all countries/regions where Azure is commercially available. Windows Azure is currently (as of March 1st, 2014) available in the following 84 countries/regions: Algeria, Argentina, Australia, Austria, Azerbaijan, Bahrain, Belgium, Brazil, Bulgaria, Canada, Chile, Colombia, Costa Rica, Croatia, Cyprus, Czech Republic, Denmark, Dominican Republic, Ecuador, Egypt, El Salvador, Estonia, Finland, France, Germany, Greece, Guatemala, Hong Kong, Hungary, Iceland, India, Indonesia, Ireland, Israel, Italy, Japan, Jordan, Kenya, Korea, Kuwait, Latvia, Liechtenstein, Lithuania, Luxembourg, Macedonia (FYRO), Malaysia, Malta, Mexico, Montenegro, Morocco, Netherlands, New Zealand, Nigeria, Norway, Oman, Pakistan, Panama, Paraguay, Peru, Philippines, Poland, Portugal, Puerto Rico, Qatar, Romania, Saudi Arabia, Serbia, Singapore, Slovakia, Slovenia, South Africa, Spain, Sri Lanka, Sweden, Switzerland, Taiwan, Thailand, Trinidad and Tobago, Tunisia, UAE, UK, United States, Uruguay, Venezuela, Belarus, Kazakhstan, Turkey, Ukraine, and Russia.

Note regarding the Credit Card requirements: All online “cloud” services space require a credit card for identity verification and trials these days. It’s the minimum bar for entry to ensure some level of validation / accountability.  If you don’t have one, you might be able to register one of those “pre-paid charge cards” from a store, provided you registered your information for online purchases – but I’ve never tried it myself.

If you want more details on the plans and how the Spending Limit works – check out this article. If you want to know how to setup Billing Alerts, check out this article.

Fill out the registration details with validation text message or automated voice call.

AzureSignup2

Once the code gets validated, the payment information becomes available. Once confirmed, you should end up at the Subscriptions page with a “pending status” as we get things setup for you.

AzureSignup3

This can take some time – click on the (Click here to refresh) option to check on it’s status.  When I wrote this blog post it took all of a minute to be ready.  Once you are listed as “Active” (my screenshot shows “Pending”) you can click on the blue Portal area up in the right corner.

Once you progress to the portal – a quick tour option is available to walk you through the very basic functionality of what the Management portal can do and it’s various notification areas that are context sensitive.

AzureSignup4

Once you have gone through the quick 5 slices of info – you are dropped into the Management Portal for your Windows Azure account. You’ll be spending some time in here working with the services and setting things up. I’ll be going over a bunch of things I’ve done in here as part of this ongoing series. Take some time, explore a bit and check out the Help in the bottom right corner of the management portal.

image

Lets have some quick fun – something all of us ServerHuggers can embrace and understand – Lets make a Windows Server 2012 R2 Virtual Machine and RDP into it!. To keep things REAL simple – I suggest you try out the Quick Create of a VirtualMachine from the big NEW button at the bottom left of your portal.

quickCreate

Fill in a unique DNS name (I use my initials RJC with demoVM to make RJCDemovm), create a local admin user name and confirm a admin password. Finally, choose a region/affinity group (where will it be hosted) and click on “Create Virtual Machine”. Once the info has been submitted – Azure will start the provisioning process and give you a status update in the portal. You can see from the shot below – mine is provisioning, it has a name of rjcdemo.cloudapp.net and you can see a job to finish it’s provisioning is running by the animated green bars in the bottom right corner of the portal.

quickCreateVM

Notice it takes some time to spin up – think of a VHD being copied out of a VM Library and then being assigned into your storage and finally being started for the first time. It has to go through the initial Sysprep like first boot activities and have configuration settings passed through to it via a custom made unattend.xml file (where do you think it got the username and password to create from?).  Eventually it will come up to a Running state.

Once it hits that Running State – you have the billing meter running (against your $200 free credit) to the tune of about $0.10 / hr for a small instance. It’s billed by the minute and you are NOT charged when it is Shut Down – so don’t forget to shut it down when you are done playing with it.

You’ll notice at the bottom, when the machine is selected you can Connect, Restart, Shut Down, Attach / detach disk, capture and Delete. Click on the CONNECT button.

quickCreateVM2

A familiar open/save dialogue opens up – save the file someplace – it’s just a RDP file that has the Fully Qualified Domain Name to your VM and the special non-standard listening port for the RDP connection (in my case it’s rjcdemovm.cloudapp.net:52778). This gets re-mapped to the proper 3389 port by Azure (more on this later). Launch this connection and sign in with the Admin ID and password you filled out in the Quick Connect form and Voila!

quickCreateVM3

NOTE: In case you didn’t know, if you sign in with a .{username} it signifies that you are logging in to the LOCAL account database of the system (since it’s not domain joined AND since I am running this demo from my corporate machine – you can see me authenticate correctly in the middle with local creds).

Accept the certificate warning and the RDP session opens to your new desktop of a server running in the cloud on an ISOLATED network that has been NAT’ed behind the Azure firewall.  Feels like home, eh?  Go ahead – poke around, check out and explore all the sort of stuff you would do when you rack a server or spin up a VM for the first time. Kick the tires and play around – all seems very familiar, eh?

ok – that’s enough for this post.  Once you are done playing around, log off the Virtual Machine and return to the Azure Management Portal.  From there, select the machine and choose SHUTDOWN from the bottom bar.  This will gracefully shutdown the VM and stop the charges for the machine in order to preserve your credit.  If you forget – it’s going to cost you $1.20 to run this overnight for 12 hrs or so – not exactly going to break the bank.

Congrats on taking the first step towards this Cloud thing as a ServerHugger.

it wasn’t so bad now, was it?

P.S. One last thing:

If you are from the developer side of the house in IT – you might already have an MSDN subscription that includes reoccurring monthly credits and benefits that can be activated. If you’re an IT guy who sits on the Infrastructure side of the house – you might want to check to see if your developer brethren have already started using this benefit and see if you can get in to the action. You see – you can have multiple admins and access to subscriptions for access to these benefits.  But really – you probably want your own space to play in and learn.

“Server Huggers” guide to Windows Azure–new series

WP_20140307_13_38_38_ProAs you may or may not know – I am a Server Hugger – heck I even have a pin to prove it. But – as I like to take on challenges, I thought I would transition my expertise out of on-premise server architecture and infrastructure and walk on the wild side for a while. I’m on a personal mission to get my head around everything there is to know about Windows Azure – from a Server Hugger’s perspective.

WP_20131031_12_32_29_Pro (340x640)Since I’m making this transition and embarking on a fully immersive Azure experience – I thought I’d document it along the way here on the blog. Don’t worry – I won’t be abandoning all things Windows Server / Storage / On-Premises – that will be continuing. I’ll be able to transition my skills to be more “cloudy” based on everything I’ve read and come out for the better on the other side.

I’ll be tagging my posts in a new category “Azure 4 Server Huggers” so you can find them amongst the stuff I have going on here. I will also caveat that each entry will be date specific as technologies evolve extremely fast in the Azure space. I’ll do my best to keep them updated as things change.

Finally – all content in this series will be coming from the perspective of a Server Hugger with 25+ years experience working in on-premises IT environments. There will be minimal “dev” stuff going on – other than how to support and work with them along the way. I’ll be bringing my architect experience along with me.

I hope you enjoy it.

signature

How To: Delete windows.old from Windows Server 2012 R2

I’ve been updating my various environments from Windows Server 2012 RTM or Preview releases (build 9431) of Windows Server 2012 R2 to the final bits. On some boxes I just use my scortched earth policy of leveling the partitions and starting from scratch – others I will do an install and use the same partition. You get the following dreaded message – which you dismiss and move on.

image

Sure – I’ll just go and delete that directory after a while and go about my merry way.

Unfortunately it is not that easy.

In Windows client environments, you can just kick off a “disk cleanup” routine and have it removed – saving you a dozen or more GB of space. Unfortunately, that Disk Cleanup does not exist in Windows Server 2012 / 2012 R2 Full GUI install, unless you add Desktop Experience.

image

Fear not. Once you have confirmed you need nothing from that old c:windows.old directory structure, you can manually delete it, with a little bit of extra effort.

Here’s how you do it.

1) Download Junction.EXE from Sysinternals. I extracted and saved it to c:source. You will use this tool to generate a list of all the junctions that have to be removed.

2) create a reference file that lists all the junction points and symbolic links in use by opening up a command prompt, changing into C:source and running

junction.exe –s –q c:windows.old >junctions.txt

3) open up PowerShell ISE administrator rights and run the following script to remove all symbolic links and junction points in c:windows.old.

foreach ($line in [System.IO.File]::ReadLines(“c:sourcejunctions.txt”))
{
if ($line -match “^\\”)
{
$file = $line -replace “(: JUNCTION)|(: SYMBOLIC LINK)”,””
& c:sourcejunction.exe -d “$file”
}
}

You should get the following scrolling by…

image

Now it’s some simple taking of ownership, granting rights and deleting windows.old to get your space back.

4) to take ownership use

takeown /F C:windows.old /R /D Y

5) delete c:windows.old – you now have permissions and ownership.

How much space you get back will change based on your particular situation.  My last run at this saved me 15.5 GB of space on my OS drive.

Note: Kudos to Peter Hahndorf’s response on ServerFault.com on which this article was based.

Re-Attach Virtual Disks automatically from StoragePools

I’ve been rebuilding some of my lab and demo machines running WS2012 R2 preview with RTM bits. As they are Cluster-In-A-Box systems, they have shared disk between them and an already configured Storage Pool. Once I did a clean install one node of the CiB with Windows Server 2012 R2 RTM bits – it sees the old storage pool disks and recognizes there is a storage pool available on the disks. I want to preserve the Storage Pool and its data, so it’s really an Import Storage Pool action I am looking to accomplish.

I found these steps from Martin Lucas on the AskPFE blog. (How to import a StoragePool)

  1. Make the physical disks available to the server (I’ve already done that).
  2. Right click the Storage Pool and choose Set Read-Write Access. Choose the server you want to enable Read-Write access.
  3. Attach the Virtual disks back. Each disk has to be selected and re-attached.
  4. Online the Volume (logical disk) to get it operational once again.

This works great, until you restart your system – at which time it recognizes the Storage Pool, but the Virtual Disks are not re-attached automatically. You can do this with a little PowerShell, since the GUI does not have the option to modify the “IsManualAttach” property.

Open your administrative level PowerShell prompt and type in the following.

Get-VirtualDisk | Where-Object {$_.IsManualAttach –eq $True}

IsManualAttach

This lists off your virtual disks where the IsManualAttach property is turned on and the disks will not auto-reattach on restart. You can see I have four of them for this demo box I use.

Now run the line again but include the following:

Get-VirtualDisk | Where-Object {$_.IsManualAttach –eq $True} | Set-VirtualDisk –IsManualAttach $False

There won’t be any output, since you are piping the results into the Set-VirtualDisk command which will modify the IsManualAttach property to false.

Voila!

My Imported StorageSpace will now re-attach my drives correctly, even on restart!