How to Install .Net Framework 3.5 on Server 2012 R2 with PowerShell

Recently, I noticed that installing .Net Framework on Server 2012 R2 is not very straightforward. When I got the below error I started looking around.

GUI Error

I found this blog, which does a beyond great job demonstrating utilizing the GUI. However, if you want to use PowerShell or don’t have a GUI (I don’t know if you can install .Net w/o a GUI though), I found the commands to do so.

In order to verify 100% that the service did not install when I tried with the GUI, I restart the computer, then ran:

Get-WindowsFeature -ComputerName VM *NET*

and got the following results.

Feature Install

Since the Role of “.Net Framework 3.5 Features” was not selected, nor were any of the features, the role has not be installed.

Following that, I installed the Windows Features and Role I needed using:

Install-WindowsFeature -ComputerName VM NET-Framework-Feature, NET-Framework-Core

This failed. If you notice from the below error, the installer cannot find the right files locally on the machine.
PS Error
So, in order to fix this, we have to insert the installation DVD (mount the ISO if virtual) and specify the path.

Install-WindowsFeature -ComputerName VM NET-Framework-Feature, NET-Framework-Core -Source D:\sources\sxs

This will allow the .Net Framework 3.5 to be installed. If you run:

Get-WindowsFeature -ComputerName VM *NET*

This will verify the needed .Net Framework 3.5 actually installed.

PS Successful

***UPDATE – you CAN install .Net Framework 3.5 on server core.

Advertisements

Edit NIC on vSphere using PowerCli

If you need to edit the VM’s NIC after you deploy the VM using vCenter, it’s grayed out. I wanted to change it from E100E to VMXNET3.

E100E

 

In order to make this change, you need to utilize PowerCli. Make sure you connect to vCenter using:
Connect-VIServer VCSA

After being connected, run:
Get-VM VM | Get-NetworkAdapter

To set the NIC to VMXNET3 run:
Get-VM Server | Get-NetworkAdapter | Set-NetworkAdapter -Type VMXNET3
Then confirm the selection by entering ‘Y’

Done

 

Once that is done, run the following command again:
Get-VM VM | Get-NetworkAdapter
As you can see, the Type is now Vmxnet3.

VMXNET3

 

Now, if you check the GUI, you’ll notice it has changed.

Final GUI

Edit Shared Mailbox SMTP Address with Powershell

Connect yourself to Exchange 2013. In this demo, I’m using office 365.

$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session

Once connected to Exchange 2013 and all of the modules have been imported, run:

Get-Mailbox -Identity xxx@domain.com

This will display tons of information about the shared mailbox. To shorten the information down to what I wanted, I ran:

Get-Mailbox -Identity xxx@domain.com | Format-List EmailAddresses

Make sure you utilize “EmailAddresses” property, not EmailAddress.

This will show you the SMTP information, and the line will look similar to:

EmailAddresses: {SMTP:xxx@domain.com, smtp: xxx@domain.onmicrosoft.com}

Now that you know what the SMTP (since it’s capital, it’s the primary address) you need to change it. Run the following command:

Set-Mailbox -Identity xxx@domain.com -EmailAddresses xxxNew@domain.com

Pretty simple. When you run the “Get-Mailbox” command again, you will see this:

EmailAddresses: {SMTP:xxxNew@domain.com, smtp: xxx@domain.onmicrosoft.com}

Now, if you send email the xxx@domain.com, it will bounce back, if you send it to xxxNew@domain.com the mail will be received in the shared mailbox.

** If you’re trying to change an email address that is part of your synchronized Active Directory, this will fail. You MUST change the SMTP setting through your Active Directory.

 

Ninite Pro with Active Directory

Today I figured out that my Ninite Pro was not installing updates on all computers automatically. I went in and looked at my list of computers and realized I hadn’t been keeping it up to date when we deploy new computers. Coming from a small environment, it’s pretty easy add them, but in a larger organization, you’d have to automate the process. Using a pretty simple PowerShell script I managed to do this.

$ADAccount = Get-ADComputer -Filter * -SearchBase "OU=Computers,DC=domain,DC=local" | Format-Table Name -HideTableHeaders
$ADAccount
Out-File -FilePath C:\%Some file location%\Output.txt -InputObject $ADAccount -Encoding ascii

The one thing that caught me by surprise (and took a couple hours to figure out) is the -Encoding parameter. By default PowerShell’s Out-File command will send it in Unicode. Apparently Ninite Pro cannot use the Unicode format and has to use ASCII.

I then created another script, that calls the previous script.

## Run script to query AD OU=WSUS_Workstations for machines
C:\%Some file location%\Get_AD_Computer_Name.ps1

## Set $NiniteFile to Computers.txt
$NiniteFile = "C:\%Some file location%\Computers.txt"

## Sets $NiniteLog to log.csv
$NiniteLog = "C:\%Some file location%\log.csv"

## Opens Ninite Pro and runs silent installers to update machines
cmd /c C:\%Some file location%\NiniteOne.exe /updateonly /remote file:"$NiniteFile" /disableshortcuts /disableautoupdate /silent "$NiniteLog"

This will output a log file that gives information regarding the status of each computers updates.

Installing and Configuring Windows Server 2012

I’ve recently decided to take a short break from VMware certifications and start expanding my Microsoft Server knowledge. I’m starting my journey to obtain my MSCE in Server 2012. I feel that paired with my VCP 5 it will be a good combination. The first exam I’m taking is the “Installing and Configuring Windows Server 2012” 70-410 exam, located here.

I’ve had trouble finding “good” study material from Microsoft and couldn’t really find a downloadable exam blueprint, maybe I got spoiled with VMware certification process. Regardless, I’ve been working on an outline that I’ve found helpful.

Feel free to download and use this guide. Let me know of any improvements that you might like to see.

Adding RAM to VCSA with Hardware Version 10

I’ve been having some performance issues with my VCSA on vSphere 5.5. Since I’m running Essential Plus, I do not have the “Hot Add” capability. Therefore, in order to add memory to my VCSA I have to shut it off.

I fired up my vSphere Thick Client right clicked on my VCSA and went to “Edit Properties”. I got this error, as expected.

Image

Which basically means that even if I turn off my vCenter server, I cannot add RAM. It HAS to be done though the Web Client since I’m running vmx-10.

The other option I have is to use PowerCLI. Once logged directly into the host, I ran “Get-VM VCSA” and got the below results.

Image

MemoryGB = 8 was what I was expecting. Since I’ve been having problems, I’m going to go up to 10GB.

First I had to power off my VM, since I was already in PowerCLI I just did it all though command line. The command for this is “Shutdown-VMGuest VCSA”

I then verified it was powered off by running “Get-VM VCSA” again.

I then ran “Set-VM VCSA -MemoryMB 10240”. The key to this is to notice that the memory is in MB and not GB (like in the above screen shot). I then verified the MemoryGB by running “Get-VM VCSA” again.

Image

I then powered on my VCSA by using “Start-VM VCSA” command. Once everything was back up, I double checked to verify amount of memory.

This wasn’t very difficult to do, and can be done pretty easily if you have a small understanding of PowerCLI. However, I found it pretty useful to have in one spot.

Upgrading VMware Tools on Ubuntu: Installation Error

After upgrading to vCenter 5.5 and ESXi 5.5 in my environment, I needed to upgrade my VMware Tools. Which generally isn’t a big deal. Usually just click and auto install (without a reboot, which is awesome) and move onto the next one.

This morning I cam across a syslog server that I’m using for my ESXi logs that is running Ubuntu Server. When I tried the automatic upgrade I got an error and was forced to mount the CD and do a interactive installation, which still isn’t a big deal.

I went ahead and followed VMware’s instructions outlined here.

Once I got to the point of running: “sudo ./vmware-install.pl -d” it failed wit this error.

Giving me the error of: “Error: Unable to execute “/usr/bin/vmware-uninstall-tools.pl.”

Therefore, I went looking for vmware-uninstall-tools and found nothing.

I decided I would do a search to find out if the file even existed, and I found it in the installation folder from mounting the drive.

I then ran the .pl from the location and got positive results.

After that I finished following the instructions on updating VMware tools and ran “./vmware-install.pl -d” and it worked.