To configure my virtual machine host (that is, my laptop), I use the Set-VMHost cmdlet. $RMSave = New-TimeSpan -hours 1 -Minutes 30 Setting the virtual machine host What I do here, is use the New-TimeSpan cmdlet to create a new time span of an hour and a half: You may want to check it out: Use PowerShell to Configure Hyper-V Resource Metering. I wrote a very detailed blog post about creating the time span for resource metering for Hyper-V. MD -Path $vmpath,$VHDPath -ErrorAction 0 Creating the time span for resource metering $VHDPath = Join-Path -Path $VMDrive -ChildPath “vms\vhd” $VMPath = Join-Path -path $VMDrive -ChildPath “vms\vm” So in my script, I create a couple of variables as shown here: The only thing I might need to change is the actual drive letter. This gives me an advantage: I might want to use the script on a different computer at some time, but I still like my folder structure. I decided to break the paths up into a couple of variables, and use the Join-Path cmdlet to create the folders. So, I know where I want to create the folders. So I decided to suppress the error message, and pass an array of folder paths to the MD function. I really do not need to see a message stating that the folder exists. But you know what? If I want to create a folder if it does not exist, all I need to do is to call the command to create the folder. I use the Test-Path cmdlet to check for the existence of the folders. If the folder does not exist, create it.Normally, I use the old process as follows: WINDOWS SCRIPT HOST ENABLE WINDOWSOne of the cool things about the MD function in Windows PowerShell is that it can create multiple folders at the same time. The command and its output are shown here. I pipe the results to the Format-List cmdlet so I can see all of the property values. Get-WindowsOptionalFeature -Online -FeatureName *hyper-v*all |įollowing the installation of Hyper-V (in addition to the Windows PowerShell management module for Hyper-V), I can use the Get-VMHost cmdlet to examine my current configuration. If you need to enable Hyper-V, you can do so by piping the results to the Enable-WindowsOptionalFeature cmdlet. To check this, use the Get-WindowsOptionalFeature cmdlet. The first thing one might need to do is to see if Hyper-V is even installed on one’s laptop. Yes! Windows PowerShell for the win! Check to see what I already have I do not need to put this off (in fact, I cannot put it off too much longer because of Windows PowerShell Saturday in Atlanta) because in addition to having the real-deal Hyper-V, I also have the real-deal Hyper-V Windows PowerShell module. I mean, why do today, what I can put off until tomorrow? The Hyper-V user interface is shown here.īut, then it hit me. So, naturally, I have been putting it off. There is the setting up of the virtual machine locations, the setting up of the machine configuration storage locations, creating virtual switches…and that is before I even begin to import any virtual machines. Having Hyper-V on my laptop and having a cool client operating system absolutely rocks! But the thought of setting it up and all the associated mousing around makes my hand ache. The thought of all that mousing makes my hand hurt I also use it when I am making presentations at conferences such as PowerShell Saturday in Atlanta-or via Lync, such as PowerShell Saturday in Singapore. I used it nearly every day to test some type of script or configuration. I will tell you that having real, live Hyper-V on my desktop operating system is a huge win for me. One project I have been dreading is setting up Hyper-V. I miss lots of apps, but I am in the process of relocating them in the store, and getting stuff installed. It boots quickly, shuts down quickly, and everything seems fresh and new. I can tell you that it runs WAY faster right now. I paved over my laptop the other day, and I am in the process of setting it up again. No cinnamon, no herbs, no nothing -only hot water and a tea bag. Instead, I grabbed a tea bag and shoved it into a cup of hot water. I have a team meeting in a few minutes, so I did not take the time to make a proper pot of tea. I am sitting here sipping a fairly nice cup of green tea. Microsoft Scripting Guy, Ed Wilson, is here. WINDOWS SCRIPT HOST ENABLE HOW TOSummary: Microsoft Scripting Guy, Ed Wilson, explains how to use Windows PowerShell to simplify the Hyper-V set-up process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |