Categories
Home Lab PowerCLI Starwind Virtual SAN Virtualization Vmware

Home Lab 2.0 – Starwind VSAN : The Greatest addition to my Home Lab

At the end of my previous post about The Beast I mentioned about lacking shared storage for my Virtual Hosts. My first thought was to go out and purchase a NAS like a Synology or a QNAP NAS. However I am trying to do this on the cheap and an extra $1200 when figuring in the cost of drives is just not in my budget. Now I am not sure about Synology, but I believe that they are comparable to QNAP in the sense that you can present disks as iSCSI LUN. Which I have done several times in the past and works brilliantly.

So here I am sitting in my office looking at the Beast and I was racking my brain trying to figure out what I can do with all this storage in this one box and how I can share it among my Virtual Hosts. I started looking at FreeNAS and running it as a VM in VMware Workstation and that worked! Until I had a power failure and the virtual disks became corrupted and I could not get them to come back online. Very Frustrating, my search continued.

Anyway, after doing some research I discovered Starwind VSAN. It allows you to take storage on a Windows machine and present it as an iSCSI LUN. I thought this is great and I signed up for a trial which gives you the ability to install it on one host but no graphical interface (it uses PowerShell) but unlimited LUNs. After some quick googling about the syntax I was able t piece together the commands with relative ease. Within a few minutes I was up an running with three new iSCSI LUNs and they were mounted in vCenter.

I mentioned earlier about having issues with FreeNAS and power failures, well ironically we had a power failure but Starwind VSAN came back online without a hitch. I was very impressed with how resilient it was. I have not had the chance to really put it through it’s paces, but so far I think I found a winner.

I plan to s follow up post once I really get off and running to the races so stay tuned for updates.

Categories
PowerCLI Virtualization Vmware

PowerCLI – How to backup VCSA 6.5

I have recently been working on an issue with a PowerCLI script that has been working for a few weeks that just stopped working. The script is modified version of the one Kyle Ruddy posted about here:
https://blogs.vmware.com/PowerCLI/2018/07/automate-file-based-backup-of-vcsa.html

The script also uses Credentials store to be able to run the script securely but other than that the script is pretty vanilla.

Now that you are up to speed with how it is supposed to work, my next post will cover the issue, and how to resolve it.

Categories
PowerCLI Virtualization Vmware

PowerCLI – Datastore Report

I recently was working in an environment where they are still running vSphere 6.0. While doing some storage expansions I discovered that the Flash Client and the C# Client were not reporting the same size on the Datastore. This can be very frustrating as you are not sure which one you can trust. So as a tie breaker I decided to turn to my good friend PowerCLI.

It turns out that the PowerCLI and the C# client were reporting the same thing. So I decided to create a PowerCLI Script to assist me in my work. You can find the script there on my Github:

https://github.com/kenbshinn/PowerCLI-Scripts/blob/master/VM_Datastore_Report.ps1

I hope you found this post helpful and will share it with your friends.

Categories
PowerCLI Virtualization Vmware

PowerCLI – Virtual Host Hardware Information

I have recently been working on a asset inventory issue where I was provided a list of serial numbers from our hardware vendor and I was asked to reconcile it with what we had. Well that is easier said than done in most cases.

I know that vCenter collects a bunch of hardware information and I wanted to see if there was a way to pull the Serial number that is on the System board and put that information into a .csv.

In comes the following command:

 Get-VMHost | Get-VMHostHardware -SkipAllSslCertificateChecks | Export-Csv C:tempVMHostHardware.csv

This command will pull all the hardware information that vCenter records and puts it to a .CSV.

I will do my best to update this post with an example of what the results will look like.

I hope you find this post helpful, if so please share with your friends.

Categories
PowerCLI Virtualization Vmware

PowerCLI – vSphere Role Privilege report

So I have been looking for ways to expand my knowledge with PowerCLI. This whole effort came about from going to VMWorld 2019 in San Francisco and seeing presentations by Kyle Ruddy and Luc Denkens. Let me tell you, they did some amazing things in their presentations. 

I had been working on a project where I needed to get list of all of the Non-Standard vCenter Roles along with the privileges assigned to those roles. I am still very new to this whole PowerCLI thing, but my google skills are top notch. I found a blog post on this blog http://kunaludapi.blogspot.com/
I ran the script to see how well it worked and it worked as advertised. I created a copy of the script on my Github which you can find here: https://github.com/kenbshinn/PowerCLI-Scripts/blob/master/vSphere_Role_Report.ps1
I hope you find this post helpful, and if you do please share it with your friends and colleagues.
Categories
Virtualization Vmware

How to unlock and reset SSO password in vSphere 6.x (2146224)

So I have a bit of a embarrassing confession to make. I forgot to record the Administrator password for my VCSA Appliance. Total disclosure, I was freaking out and I really thought I was going to have to start from scratch. I did some research I was surprised to find out that you can actually reset the Administrator account on a VCSA appliance as long as you have the root password for the appliance and you have access to the VCSA Console. Below are a list of the links to the KB Articles from VMware.

Resetting SSO Administrator Password
https://kb.vmware.com/s/article/2034608
Resetting SSO Administrator – VCSA 6.x

Below is the PUTTY session as an example.

shinnk@Computer:~$ ssh [email protected]
ssh: Could not resolve hostname devvcsa01.xxx.xxxxx: Name or service not known
shinnk@Computer:~$ ssh [email protected]
The authenticity of host ‘172.26.44.18 (172.26.44.18)’ can’t be established.
ECDSA key fingerprint is SHA256:7E4K1HVpg2ExWz+vEkkRdJ0M5jUYftb3HZw6OSDKFEICSOEPWWKYERe4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.26.44.18’ (ECDSA) to the list of known hosts.

VMware vCenter Server Appliance 6.5.0.21000

Type: vCenter Server with an embedded Platform Services Controller

Password:
Connected to service

    * List APIs: “help api list”
    * List Plugins: “help pi list”
    * Launch BASH: “shell”

Command> shell.set –enabled true
Command> shell
Shell access is granted to root
root@devvcsa01 [ ~ ]# /usr/lib/vmware-vmdir/bin/vdcadmintool

==================
Please select:
0. exit
1. Test LDAP connectivity
2. Force start replication cycle
3. Reset account password
4. Set log level and mask
5. Set vmdir state
6. Get vmdir state
7. Get vmdir log level and mask
==================

3
  Please enter account UPN : [email protected]
New password is –
/a+p|8M?vRl`%”p4*+oZ

==================
Please select:
0. exit
1. Test LDAP connectivity
2. Force start replication cycle
3. Reset account password
4. Set log level and mask
5. Set vmdir state
6. Get vmdir state
7. Get vmdir log level and mask
==================

Once you go through all these steps you are now able to log into VCSA with that temporary password that you are given and you are also able to reset it as well.

I hope you find this post helpful, and if you do please share it out to your friends.

Categories
PowerCLI Virtualization Vmware

Getting past Certificate issue in Power CLI

So I recently started working more with PowerCLI. After my time at VMWorld 2019 (which I will cover in another post) I realized how powerful that PowerCLI actually is (pun not intended). In starting to work with PowerCLI I came across the following message whil: trying to connect to my vCenter

Connect-vIServer : xx-x-xxxx xx:xx:xx Connect-VIServer Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Prompt if you’d like to connect once or to add a permanent exception for this server.

I did some googling and I found this article,so shout out to Ivo Beerens for his article.

https://www.ivobeerens.nl/2018/07/18/quick-tip-powercli-invalid-server-certificate-error/

In his article he goes on to share this command

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

After putting that into PowerShell and pressing enter you will no longer get the Invalid Certificate message.

I hope you found this post helpful, I will be posting about some of the scripts that I have been posting on my Github. Please share with your friends if you found this helpful. 
Categories
Exchange Microsoft Office 365 PowerShell

Enable a Remote Mailbox in Office 365

So I recently ran into an issue where I had a user who’s Local AD account had been deleted but their Office 365 Mailbox was still showing up. We tried to bring the user account back, however the AD recycle bin was not enabled. So we had to create a brand new account for the user and then work from there.

We originally planned to create a new mailbox and let the user start from scratch. However we ran into an issue were the old mailbox would not go away, and it was preventing us from migrating a new mailbox into Exchange Online for the user.

I then found the following Exchange Management Shell command which will allow you to connect the local AD account to the Exchange Online Mailbox.

Enable-RemoteMailbox USERNAME -RemoteRoutingAddress [email protected]

After running the command the user is now able to log in with their new AD account and have access to their mailbox.

I hope you found this post helpful, and if you did, please share it with your friends.

Categories
PowerCLI Virtualization Vmware

Power off entire Virtual Environment using a PowerShell Script and PowerCLI

So I have a lab that I manage where we have had several scheduled power outages in the last few months. So it is my job to make sure that we power off the lab so none of our equipment have issues when we bring it back up.

I would estimate that our lab is comprised of about 90% VMware ESXi Hosts, and after going through the exercise of powering off the whole lab 1 or 2 times, it became it bit of a pain.

So I created a PowerShell Script using PowerCLI to not only power off all the Virtual Machine, but also the Virtual Hosts, and the VCSA appliance itself.

I have posted the script to my Github which you an check out here:

https://github.com/kenbshinn/Poweroff_VirtualEnvironment

Feel free to check it out and let me know what you think.

I hope you found this post helpful, and if so, please share it with your friends.

PowerShell – Windows Update report to .CSV

A while back I was asked by my boss to come up with a way to get a report of all the Windows Updates installed on a remote server that is at a client’s site and that we do not have access to.

I thought to myself that he must be crazy to think that we could even find a utility that would enable us to do that.

Well….. Apparently with the right Power Shell Commands you can do it. Here is the Syntax for the Script that you will need to save as a .ps1

$Session = New-Object -ComObject “Microsoft.Update.Session”
$Searcher = $Session.CreateUpdateSearcher()
$historyCount = $Searcher.GetTotalHistoryCount()
$Searcher.QueryHistory(0, $historyCount) | Select-Object Date,
   @{name=”Operation”; expression={switch($_.operation){
       1 {“Installation”}; 2 {“Uninstallation”}; 3 {“Other”}}}},
   @{name=”Status”; expression={switch($_.resultcode){
       1 {“In Progress”}; 2 {“Succeeded”}; 3 {“Succeeded With Errors”};
       4 {“Failed”}; 5 {“Aborted”}
}}}, Title | Export-Csv -NoType “$Env:userprofileDesktopWindows Updates.csv”

The result looks something like this:

I hope you find this post helpful and are able to use this going forward.