Changing Nano back to DHCP
Musings of a PowerShell Mad Man
by
4y ago
I've been playing around some more with Nano server, but I didn't want to create yet another VM, so I decided to use one of my existing Nano servers. But it had an IP set already, and was set to an Internal switch (so no internet connectivity possible). So let's PowerShell-fix this! First let's change the adapter of my VM called nano1: Get-VM nano1 |Get-VMNetworkAdapter|Connect-VMNetworkAdapter -SwitchName external There, that didn't hurt so much! Good, now let's change the settings inside the nano1 VM, to set the IP's back to DHCP. First, this very cool thing in Hyper-V called PowerShell D ..read more
Visit website
Linked clones in Hyper-V
Musings of a PowerShell Mad Man
by
4y ago
I've allways been a fan of VMware Workstation, but I've been spending a bit of time with Hyper-V on Windows 10 now too to see how the cookies are on the other side. One thing I thought I missed was creating what is called linked clones in VMware Workstation. Linked clones allow a user to create multiple VM's that are referenced off of only one VM. The changes compared to the first VM are stored in a so called delta file under the covers. This way, you can build a large lab while needing a lot less space. You will however need access to the original VM files. It turns out Hyper-V has the ..read more
Visit website
Turning on nested virtualization Hyper-V
Musings of a PowerShell Mad Man
by
4y ago
I've been playing around with Hyper-V these past few weeks, and it seems to work rather well (VMware needs to start worrying). One of the features I've been playing with is nested virtualization. Unlike VMware Workstation where you can select Hyper-V as one of  the install options, in Hyper-V on Windows 10 and Windows 2016, you can turn it on on a per VM basis, with the following command: Set-VMProcessor -VMName NestHostVM -ExposeVirtualizationExtensions $true Now you can have a Hyper-V inside your Hyper-V. I'm so hyped about this! <drumroll> To get a list of which VM's have it ..read more
Visit website
F5 management through PowerShell
Musings of a PowerShell Mad Man
by
4y ago
I've mentioned in my vCPU upgrade article that one of the requirements of me being allowed to shut down the VM was to be sure that there were no connections on the F5 loadbalancer for the webserver. So I needed to script against the F5 loadbalancer. The first thing you need to do, is to get the F5 PowerShell Snapin from the F5 site. An account can be made for free, then you can login and download the plugin and follow the instructions to get it installed. Once installed, you can add the snapin with: Add-PSSnapIn iControlSnapIn Now you have commands to manage the F5. Great, now it's time to ..read more
Visit website
Adding a Windows Nano server to the domain
Musings of a PowerShell Mad Man
by
4y ago
In my previous article, I created a Nano server image. This one is about adding the Nano server to a domain. Adding Nano servers to a domain isn't a pretty little single cmdlet like many others are, but consists of a list of things to do: Configure DNS on the Nano server Create what's called a blob file on a DC (or a machine that is joined to the domain, and a user that has rights to add a computer to the domain or as a Domain admin user) Copy the file over to the Nano server Use the blob file to add the server to the domain Reboot I've found the following code on petri.com site, with an i ..read more
Visit website
Creating a Nano Server Image
Musings of a PowerShell Mad Man
by
4y ago
Installing Windows 2016 Nano server isn't simply adding the DVD and clicking next-next-finish, but it needs some preparation. The base nano image wim file is only 168MB, but that has no functionality in itself. More needs to be added through features, drivers and packages. From a management workstation, mount the Windows 2016 ISO (i.e. doubleclick it, take note of the driveletter). On the ISO file you will see a NanoServer directory: That directory has the NanoServer.wim file, Packages folder and a NanoServerImageGenerator folder. That last folder contains a PowerShell Module, which y ..read more
Visit website
Getting rid of trailing spaces in CSV's with Powershell
Musings of a PowerShell Mad Man
by
4y ago
There I was, banging my head against the table because I thought I was perfectly able to select stuff from a CSV file, but I could not figure out why my selections weren't showing the stuff I wanted. It turns out my CSV file entries were full of trailing spaces! Googling around, I saw this in a forumpost somewhere, but to prevent me from losing it, I've put the script below: $CSV = import-csv  'C:\scripts\trailingspaces.csv'         $CSV | Foreach-Object {               $_ ..read more
Visit website
Sending emails
Musings of a PowerShell Mad Man
by
4y ago
Short one for my own recollection. Sending emails is easy from within PowerShell Send-MailMessage -From "fromthevcenter@whatever.com" -To "first.email@someaddress.com", "second.email@someaddress.com" -SmtpServer "thesmtpaddress" -Subject "VM Expansion $VM Completed" -Body $body This was one of my requirements of my other post about upgrading the vCPU's ..read more
Visit website
Store credentials securely for later use
Musings of a PowerShell Mad Man
by
4y ago
A command you use quite often is Get-Credential. For instance for creating a PSSession to a server: $cred = Get-Credential "admin" $s = New-PSSession -Computername myserver -Credential $cred It's nice for on the spot use, but in a script that might not work. There are ways of doing that plaintext, but I saw a webpage that unfortunately I don't have the link for anymore, but if I find that reference I will add, but you can store those credentials securely too: $Credential = Get-Credential $Credential | Export-CliXml -Path "D:\akos\Myserver.Cred" This small piece of code lets you store c ..read more
Visit website
Waiting for a VM to come back
Musings of a PowerShell Mad Man
by
4y ago
In my previous post, I wrote about upgrading vCPU's, and that I want to do several other things as well. If you upgrade a vCPU on a VM, it could very well be that the Windows guest wants a second reboot. I've found that simply rebooting and waiting for a while is inefficient. So I usually check if the VMware tools are back online. I've made that into a function, to exactly that: function WaitforVM($VM) {     while (((get-vm $VM ).ExtensionData.Guest.ToolsRunningStatus ) -ne "guestToolsRunning" )         {     &n ..read more
Visit website

Follow Musings of a PowerShell Mad Man on FeedSpot

Continue with Google
Continue with Apple
OR