Wednesday, 22 March 2017

Disable SMBv1 on multiple computers using PowerShell

Or, Easiest way to disable SMBv1 on multiple computers
Or, Disabling SMB V1 on multiple computers with windows PowerShell
Or, Steps for disabling SMB V1

Descriptions: Recently US-CERT has reported vulnerability with “Microsoft SMBv1”. US-CERT encourages users and administrators to review Microsoft Security Bulletin MS17-010 and apply the update. In this article, we will see how to disable SMB V1.0 from various operating systems.

Vulnerability Details: Microsoft has released a security update to address a vulnerability in implementations of Server Message Block 1.0 (SMBv1). Exploitation of this vulnerability could allow a remote attacker to take control of an affected system.

What is SMB/SMB 1.0? SMB stands for “Server Message Block”. It is a legacy file and print sharing protocol. SMB 1.0 is a vulnerable and Microsoft has deprecated it. It has server as well as client components, so when you are thinking to disable the SMB 1.0 protocol, you should do it for both platforms (client and server).

Environment Details: You have multi-OS infrastructure and want to disable SMB 1.0 on all of them. In my case, I have following Operating Systems Windows Server 2012, Windows Server 2012 R2, Windows Server 2008, Windows Server 2008 R2, Windows 10, and Windows 7.
I have copied all the relevant computer name in a text file and want to disable SMB 1.0 on all servers/computers that are listed in this txt file.
I have segregated the PowerShell commands in two sections (Client Side SMB and Server Side SMB) with supported cmdlets. You can choose and run whichever is suitable for your environment.

Precaution: You should test and understand the commands in your test environment first and run in the production if satisfied with the result thereafter.

Steps: Disabling SMB V 1.0 on various operating systems.

Open Windows PowerShell ISE (Run as Administrator) > Prepare for the below PowerShell commands











The text version of above commands are given below:

=========================================================================
DISABLE SERVER SIDE SMB V1 PROTOCOL
=========================================================================

# Disable SMB V1 - Windows Server 2012 R2, Windows 10 and Windows 8.1
$ComputersList = Get-Content -Path "D:\temp\testservers.txt"
Invoke-Command -ComputerName $ComputersList {Remove-WindowsFeature FS-SMB1 -NoRestart}

# Disable SMB V1 - Windows 8 and Windows Server 2012
$ComputersList = Get-Content -Path "D:\temp\testservers.txt"
Invoke-Command -ComputerName $ComputersList {Set-SmbServerConfiguration -EnableSMB1Protocol $false}

# Disable SMB V1 - Windows Server 2008, Windows Server R2, Windows 7 and Windows Vista
$ComputersList = Get-Content -Path "D:\temp\testservers.txt"
Invoke-Command -ComputerName $ComputersList {Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 0 -Force}


=========================================================================
DISABLE CLIENT SIDE SMB V1 PROTOCOL
=========================================================================

# Disable SMB V1 - Windows Server 2012 R2, Windows 10 and Windows 8.1
$ComputersList = Get-Content -Path "D:\temp\testservers.txt"
Invoke-Command -ComputerName $ComputersList {Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol -NoRestart}

# Disable SMB V1 - Windows Vista, Windows Server 2008, Windows 7, Windows Server 2008 R2, Windows 8, and Windows Server 2012
$ComputersList = Get-Content -Path "D:\temp\testservers.txt"
Invoke-Command -ComputerName $ComputersList {sc.exe config lanmanworkstation depend= bowser/mrxsmb20/nsi}
Invoke-Command -ComputerName $ComputersList {sc.exe config mrxsmb10 start= disabled}

Updated: 25/03/2017
IMP Note: 
1. Please replace the computer list input path with the one you are having in your environment.
2. Please replace "Remove-WindowsFeature FS-SMB1 -NoRestart" with "Uninstall-WindowsFeature -Name 'FS-SMB1'" in case the first command failed.


IMP References: If you want to know more about SMB V 1.0 and related information, you must check below KBs.






Cheers, Please write me back if you have any query of feedback on this.

Friday, 17 March 2017

Working fine in IE but chrome reporting the site as dangerous - deceptive site ahead

Or, Dangerous site reported by chrome working fine in Internet Explorer
Or, "Deceptive site ahead" error in chrome, working fine in IE

Descriptions: You may face this error while browsing some sites. This may behave deferentially in different browsers. In my case, it was working fine with Internet Explorer but when I tried to open the same URL in chrome, it was showing me this error.

Error Message:
Deceptive site ahead
Attackers on mysite.com may trick you into doing something dangerous like installing software or revealing your personal information (for example, passwords, phone numbers or credit cards).
Automatically report details of possible security incidents to Google. Privacy Policy


Error Screenshot:
















Solution/Workaround:

Go to Chrome Settings

























On the bottom of the page, click on “+Show advanced settings”














Scroll down and go to Privacy section > Un-check “Protect you and your site from dangerous sites” > Try to browse the site again, it should be fine.












Other recommendations:
It’s good to check with the site developer and ask them to fine tune the site if this issue is being reported on your newly created websites.

Some useful information about this behaviour are as below:

Cheers, please write me back if you have any query or feedback on this.

Wednesday, 15 March 2017

Emails received today are being grouped as tomorrow's in outlook 2016

Or, Today’s emails are appearing in outlook inbox under tomorrow group…
Or, Why my emails are appearing in tomorrow date section in outlook
Or, Outlook today bug - it shows tomorrow as today (outlook 2016 with Office365 email server)

Descriptions: Guys, I had reported this issue to Microsoft O365 support as well as on Microsoft Answer community. They helped me with some good tools to check this issue but no luck at all. It was frustrating when my emails received today were appearing as tomorrows emails.

Reference error screenshot:









Environment Details:
Operating System:   Windows 10 Anniversary Update X64
Email Client:             Outlook 2016 Standard X64

What was the culprit?
Yes Guys, It was “Region and Language” Settings on Windows 10 and the Office365 online portal was different.

Solution:
Match the Time Zone Settings and Region & Language Settings on Windows Machine as well as on online Office365 portal.

In my case, the correct settings are as below.

On Windows Machine’s Side















On Office365 online account’s side:


















Verify if the location of your computer is set to your correct location


























You can also check out my thread on Microsoft community...

Updated: 13/04/2017
Guys, there are few cases where the above workaround is not solving the issue. In that case, you may try the below options:
1. Re-create your windows profiles (this should fix the issues, if not you can try the second option)
2. Re-install the Operating System

Updated: 02/06/2017
You can try to Downgrade or upgrade the MS office software, this may also help in resolving the reported issue.

Instead of performing an in-place upgrade, it's better to uninstall the current version of MS office and then install the newer or older version.

Updated: 12/09/2017
Another cool workaround we have found. You may try to Disable "Microsoft Exchange Add-in" from outlook and the issue should be fixed.

Updated: 23/02/2018
We have noticed the problem with some 'custom developed outlook Add-in' also. If any of the above solutions are not working for you, you must try to find out if you have any local custom developed outlook add-in installed. If yes, try to remove it and see if that works for you.

If removing the custom developed outlook is working fine, then you must consult with your local developers to get that outlook add-in code corrected.

Example: if you have below line written in your outlook code, try to comment it and see the result...

Function pPatternTime_AM_PM_array(txtRng, wList1Dic, wlError) 

Cheers, please write me back if you have any query or feedback.

Monday, 13 March 2017

Removing snapshot of multiple Virtual Machines – vSphere PowerCLI

Or, Working with removing multiple virtual machine’s snapshots – vSphere PowerCLI
Or, Removing multiple virtual machine’s snapshots using vSphere PowerCLI
Or, Removing common snapshots from multiple virtual machines in one attempt

Descriptions: Fiends, in my previous article of VMware snapshots series; I explained how to take snapshot of multiple virtual machines in single attempt. Now in this Article, we will see how to remove a common snapshot from multiple virtual machines in one attempt.

This is our daily routine task when we take snapshot of VMs for some maintenance activities and then we have to remove then once the job done.

The very common scenario is “Patch Management”. If you perform patch management, you are enforced to keep a common name of the snapshot you are taking for each VMs due to patch management activity and that’s a good thing you do…Seriously... J

So if you have already taken snapshot of multiple VMs with a common name, you can easily remove those snapshots from all VMs with a single command. We are going to do the same thing in this article.

Scenario:
1. I have three test VMs – TestVM-1, TestVM-2, and TestVM-3
2. Taken a common snapshot on each VMs for a maintenance activity – snapshot name is “Test-Snapshot
3. Want to remove snapshot “Test-Snapshot” from all these three VMs

Useful PowerCLI Commands You can explore to learn more:
PowerCLI C:\> get-help Remove-Snapshot
PowerCLI C:\> get-help Remove-Snapshot -Examples


Steps-1:  Checking for common snapshot on targeted VMs

From vSphere PowerCLI, run the below command to check if the targeted VMs are having common snapshots (Please replace VMs name with yours).

PowerCLI C:\> Get-VM TestVM-1, TestVM-2, TestVM-3 | Get-Snapshot

The Result/Output of the above command
Name                 Description                          PowerState
----                         -----------                                ----------
Test-Snapshot        TestSnapshot-dis               PoweredOff
Test-Snapshot2       TestSnapshot-dis2            PoweredOff
Test-Snapshot        TestSnapshot-dis               PoweredOff
Test-Snapshot2       TestSnapshot-dis2            PoweredOff
Test-Snapshot        TestSnapshot-dis               PoweredOff
Test-Snapshot2       TestSnapshot-dis2            PoweredOff

So, now we have two snapshots on each targeted VMs. In your case, it may be one or more. Here we have to choose the snapshot name that we want to be removed.

In my case, I am taking example snapshot name “Test-Snapshot


Steps-2:  Verifying for selected common snapshot on targeted VMs

From vSphere PowerCLI, run the below command to verify if the targeted VMs are having selected common snapshots (Please replace VMs name with yours)

PowerCLI C:\> Get-VM TestVM-1, TestVM-2, TestVM-3 | Get-Snapshot -Name Test-Snapshot

The Result/Output of the above command
Name                     Description                        PowerState
----                              -----------                        ----------
Test-Snapshot        TestSnapshot-dis               PoweredOff
Test-Snapshot        TestSnapshot-dis               PoweredOff
Test-Snapshot        TestSnapshot-dis               PoweredOff

Now in the above result/output, we can see that the snapshot we had selected “Test-Snapshot” is present on all targeted VMs.

Let’s proceed  with the removal then…


Steps-3:  Prepare the $snapshot1 parameter

From vSphere PowerCLI, run the below command to prepare for the $snapshot1 parameter (Please replace VMs name with yours)

PowerCLI C:\> $snapshot1 = Get-VM TestVM-1, TestVM-2, TestVM-3 | Get-Snapshot -Name Test-Snapshot


Steps-4:  Removing the selected snapshot from all targeted VMs

Run the below command to execute the snapshot removal from all selected VMs

PowerCLI C:\> Remove-Snapshot -Snapshot $snapshot1 -RunAsync

The Result/Output of the above command
If prompted, select the desire option to confirm the execution. In my case, I selected “A” to confirm for all (Yes to All).
--------------------------------------------------------------------------------------------------------------------------
Confirm
Are you sure you want to perform this action?
Performing the operation "Removing snapshot." on target "VirtualMachineSnapshot-snapshot-6931".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A

Name                                        State                  % Complete Start Time   Finish Time
----                           -----      ---------- ----------   -----------
RemoveSnapshot_Task            Running             0 03:26:10 PM
RemoveSnapshot_Task            Running             0 03:26:31 PM
RemoveSnapshot_Task            Running             0 03:26:34 PM
--------------------------------------------------------------------------------------------------------------------------

That’s it... Selected snapshot has been removed from all targeted VMs.

Cheers, Please write me back if you have any query of feedback on this.

Customize fonts and colour of blogger menu bar

Or, How to change fonts or colour of tab and menu bar in blogger?

Descriptions: It was one of the tedious and time-consuming task for me when I was looking for some possibilities to customize the colour and fonts of my blogger blog. There were lots of article which were suggesting many <html> codes to achieve the same and it was again not easy task for me to place those codes appropriately.. Frankly, I am not a html expert…

Finally, after some R&D on my test blog, I found that it was one of the easiest task to achieve using blogger advanced settings. Yeah, its on GUI… J

Therefore, I thought to share this with you guys. May be it will save your time as well.

Reference Screenshot: Current Scenario
1. Going to change Menu bar colour from Blue to Something else
2. Going to change Tab Text colour from white to something else











Steps:
Login to your Blogger page > Go to Theme > Choose Customize














Click on Advanced option











Select Tabs Background > Adjust the colour type as per your requirements (reference screenshot given below):











Now to change the Tab Text Colour, select Tab Text option and adjust the colour as per your requirements.













After making the changes, click on Apply to Blog button on top right corner of the page.








That’s it, this how now test blog is appearing...










Cheers, Please write me back if you have any query or feedback.

Sunday, 12 March 2017

Automate Virtual Machines creation using vSphere PowerCLI

Or, How to create VM automatically using vSphere PowerCLI
Or, Easiest way to automate Virtual Machines creation
Or, Automating creation of Virtual Machines in VMware

Descriptions: Being a VMware administrator this is something a routine job to create Virtual Machines. When it is one or two VM, that is easy but what if you have to create at least 10-20 VMs in next 10-15 minutes? That is not possible to achieve manually.

In this scenario, you must be having some automation in place to do this job for you, off-course in 10-15 minutes depending on your Infrastructure capabilities. There are multiple ways to automate this task depending on your requirement.

Important Note: There are many articles on the web where some people have suggested creating VM using New-VM cmdlet without using any template but my friends that is not the real VM creation. It is just a VM instance without Guest OS where you have to install Guest OS manually, which is time taking process, as you already know and this is the one pain area you want to be automated.

In this article, we will be using VM template to automate the VM creation with one click approach.

The only few things you need to do after VM creation are:
1. Change Computer/Host Name inside Guest OS
2. Assign appropriate network port group to the newly created VM

Prerequisites:
1. You must have fully patched VM template created in your VM Infra
2. Basic understanding of vSphere PowerCLI
3. vSphere PowerCLI Installed on your machine
4. Administrative privileges to complete this task
5. Following Information handy (Template Name, Datastore Name and Cluster Name)

Steps:
Open vSphere PowerCLI > Type the command below and hit enter

Connect-VIServer IPAddressOfvCenterServer












To prepare for the automation, please run below commands sequentially:
--------------------------------------------------------------------------------------------------------------------------
    $MyTemplate = Get-Template -Name MyTestTemplateVM
    $myDatastore = Get-Datastore -Name MyTestDatastore
    $myCluster = Get-Cluster -Name MyTestCluster
--------------------------------------------------------------------------------------------------------------------------

Note: Please replace MyTestTemplateVM, MyTestDatastore, and MyTestCluster with your VM Template Name, Datastore name and Cluster name respectively.

That’s it, your automation environment is ready to go… just a single command (when repeating just up arrow and one click) to create your virtual machine automatically.


Now run the below given command to start creation of your Virtual machine:

New-VM -Name NewVMName -Template $MyTemplate -Datastore $myDatastore -ResourcePool $myCluster

Note: Replace NewVMName with your VM Name.

Cheers, Please write me back if you have any query or feedback on this.

Failed to log on to Microsoft Windows. Symantec backup Exec 2012 Error in Backup Job.

Or, Failed to log on to Microsoft Windows. Ensure that your logon credentials are correctly entered.

Symantec Backup Exec 2012 Schedule Job Error:
The job failed with the following error: Failed to log on to Microsoft Windows. Ensure that your logon credentials are correctly entered and that they meet the following minimum requirements to log on to a Windows computer: - The credentials used are a member of the Backup Operators group. - For Windows Vista/2008 and later, the credentials have the Log on as a batch job privilege. Additional privileges may be required to access resources on the Windows computer.

Solution:
1. Login to Client Server (For which backup is failing).
2. Right Click on Computer > Manage > Configuration > Local User and Group > Group
3. Right Click on Group > Properties > Add > Here add your logon account of backup server which is being used for taking backups (if you will edit credential setting of any backup job, you can see the logon account information which is being used for backups) > Ok.
4. Restart Backup Exec Remote Agent services on client server.
5. Now Login to Backup Exec Server
6. Restart Backup Exec Agent Browser Service.
7. Restart Backup Exec Job Engine Service.

Now you can check with browsing backup job setting of problematic backup client server, It will allow you to browse it's directories.

Run the backup job again, it should not throw this backup failure error again...


Cheers, Please write me back if you have any query or feedback.

Event ID 1026, Event ID 3551, Event ID 1000 on SharePoint application server.

Or, SharePoint Central admin IIS application pool getting stopped automatically...

Errors:
1. Faulting application name: hostcontrollerservice.exe, version: 15.0.4420.1017, time stamp: 0x50672c2d Faulting module name: KERNELBASE.dll, version: 6.3.9600.17055, time stamp: 0x532954fb Exception code: 0xe0434352 Fault offset: 0x0000000000005bf8 Faulting process id: 0xd44 Faulting application start time: 0x01cfcb471850b6f5 Faulting application path: C:\Program Files\Microsoft Office Servers\15.0\Search\HostController\hostcontrollerservice.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: 56be61a3-373a-11e4-80ef-06a3adca6e46
2. SQL database login for 'SharePoint_Config' on instance 'epmdbsrv' failed. Additional error information from SQL Server is included below.
3. The process was terminated due to an unhandled exception.
Exception Info: System.Collections.Generic.KeyNotFoundException

Solutions: I applied following fixes to resolve this issue.

On DB Server:
SQL rights “SharePoint Admin Content Database” under security\users section corrected. Assigned rights on WSS_Content_Application_pool and other SharePoint related memberships to SharePoint user. Do the same things for other DBs related to SharePoint Server.

On Application Server:
Granted full rights to SharePoint user account on C:\Program Files\Microsoft Office Servers\15.0\Config folder.

Granted full rights to SharePoint user account on registry Path: computer\hkey_local_machine\Software\classes\appID\{61738644-F196-11D0-9953-00C04FD919C1}

Make sure SharePoint user is having rights in “Log on as service” and “Log on as a batch job” in group policy on local computer or in GPO if applicable.


Cheers, Please write me back if you have any 

Saturday, 11 March 2017

Trace deleted virtual disk in VMware

Or, Tracing deleted VMDK files in VMware
Or, How to check who deleted the virtual disk of the virtual machine in VMware?

Descriptions: First thing first, Once you have deleted the virtual disk by selecting “Delete From Disk” option, VMware cant help you to get it back as they dont have any built-in recovery solution in VMware. You may consult data recovery vendors to check for any possibility of data restoration.

In common scenario, if the disk was deleted by someone else or it was done unknowingly, an administrator is always asked to trace the logs..

At first attempt, VMware administrators prefer to check the task and events of vSphere client which is very much useful in most of the cases but not for all the cases.

For example: If someone have deleted the disk of VM, modified RAM capacity, or Modified CPU capacity, vSphere will have almost similar kind of event for all these actions (like, Reconfigure Virtual Machine). In this case, you will not be able to understand at what stage HDD or deleted and at what stage CPU was updated.

In this article, we will see some available options to trace the logs more efficiently for deleted vmdks.

Steps: How to trace the logs for deleted VMDK?

1. Check for the Tasks and Events in vSphere Client for the affected Virtual Machine and note down the “Reconfigure” event details time stamps
2. Check for the associated Datastore from which the disk was deleted
3. Check for the Host on which this Virtual Machine was running when the Modify event was occurred.












SSH the Host in Putty and run the following commands sequencially

# ls -la
# cd vmfs/volumes
# ls -la
# cd Datastore
# ls -la
# cd VMName
# ls -la
# less vmware.log | less

Search for the logs:

1. (Destroying Virtual Dev for scsix:xxx vscsi=xxxx)
2. (DISKLIB-VMFS : ‘’vmfs/volumes/xxxx-xxxxx-xxxx-xxxx-VMName/VMName-Flat.VMDK” : Closed )





Above two highlighted events gives some clue about VMDK deletion. It was started from term “Destroying” and completed at term “Closed”.

Cheers, Please write me back if you have any query or feedback..

Saturday, 25 February 2017

vCenter Server running out of space, vcenter_log.ldf consuming huge disk space

Or, vcenter_log.ldf consuming huge disk space on vCenter server.
Or, How to shrink vcenter_log.ldf database in vCenter server?
Or, How to release log file or .ldf file occupied space in SQL database?

Descriptions: Friends, this is a very common task for across all SQL Databases but in this article we will be exploring it in respect of vCenter server which is running on SQL database. You can shrink logs for any other databases as well by following the same steps but there may be some pros and cons for doing it according to applications for which it is being used and you should understand the risk of doing it.
In scenario of vCenter server, I don’t see any impact of shrinking of ldf database in my case.

Scenario: Your vCenter server is using SQL database and somehow the vcenter_log.ldf database file has occupied more than 90% of disk space on your server. Now you want to release the space occupied by the log files.

Prerequisites:
Admin rights on SQL database on which you are going to perform this action.
Please take backup of your database before performing shrink task


Reference Screenshot (too large log file before shrink):






Steps: shrinking .ldf database log files
Login to your vCenter server with Administrative privilege > Login to SQL Server using SQL Management Studio to access Databases > Navigate to your vCenter Server Database > Right Click on vCenter Database > Go to Properties

























Go to Options > Choose Simple under Recovery Model drop-down list > Click OK






















Once more right click on your vCenter Database > Go to Tasks > Select Shrink > Select Files





















In the General option, Choose Log under File Type drop-down list > Make sure filename_log is automatically populated under File Name drop-down option > Under Shrink Action, Select Release Unused Space > Click OK > Wait for Shrink action to be completed






















You are done. You can check your log file size, it should be appearing small in size. Also your disk space should be healthy now.

Reference screenshot (small log file after Shrink):








Cheers, please write me back if you have any query of feedback on this.

Saturday, 18 February 2017

Managing Guest OS, software or database inventory with VMware vSphere

Or, Way out to manage software inventory of Virtual Machine in VMware vSphere without any additional or third-party inventory tools
Or, Managing software inventory list of the Virtual machine without inventory tools

Description:  We understand that it is not possible or the priority for every small or mid-level company to have inventory tools to manage software inventory list of VMware infra Guest machines. Although, there are some free tools available in the market, but some companies may not be interested to have any kind of free tools even, due to security and compliance risks.

So what next? It's tough or easy, you have to manage the software inventory list of Virtual Machines.

The way out is to define Note and Folders for each virtual machines in your VMware Infrastructure, for their easy management for inventory or navigation purpose and then exporting the detailed report of all the VMs using PowerCLI.

This is a one-time job to write the Notes for each Virtual Machines and creating departmental or any relevant category based folders.

Once you have everything defined well as recommended, you would be able to see the VMs inventory report like below,





Based on my convenience, I have modified the yellowed columns manually after exporting it so that the report looks good and enough informative.

Here is the step-by-step instruction to achieve this requirement.

Let’s Prepare the VMware vSphere management console.

Step-1: Creating VMware Folders

Please create Department based or any relevant category based VM folders under your VMware Datacenter.

It may look like the below reference screenshot.













Step-2: Identifying and writing the notes for each Virtual Machines

Please Select the VMs one-by-one > go to Summary tab > Click on Edit under Annotations option > write your Software name/list in Notes section > Click OK to save the changes.














Step-3: Exporting the Virtual Machines report with VM Name, Guest OS, VM Folder, and Software Inventory Notes

Connect to your vCenter server using vSphere Power CLI > Type the command given below > Hit Enter to execute it

Get-VM | select Name, Guest, Folder, Notes | Export-CSV D:\test.csv

Updated: 24/02/2017

To add Info in the report like Datacenter etc.. you can use below command format:
Get-VM | select Name, Guest, Folder, Notes, @{N="Datacenter";E={Get-Datacenter -VM $_}} | Export-CSV D:\test.csv



Updated: 21/06/2018

To add info in the report like Guest IP address... you can use below command format
PowerCLI C:\> Get-VM | select VMHost, Name, Guest, Folder, Notes, @{N="Datacenter";E={Get-Datacenter -VM $_}}, @{N="IP Address";E={@($_.guest.IPAddress[0])}} | Export-CSV D:\test.csv


Note:  You should change the output file path from D:\test.csv to any other folder path suitable as per your scenario.

Once the command is completed, you will be able to see the report you have been looking for so far.

Cheers, please write me back if you have any query or feedback on this.

Friday, 17 February 2017

Multiple Virtual Machines snapshot using CSV file input and vSphere PowerCLI

Or, How to take snapshot of multiple VMs from CSV file VMs list?
Or, Import-CSV VMs snapshot using vSphere PowerCLI
Or, Taking snapshot of multiple VMs listed in CSV file

Descriptions: In my previous article, I explained how you could perform snapshot of multiple Virtual Machines using vSphere PowerCLI, but in that article, we just did the listing on VMs on the CLI console itself.

Now, in this article the approach of listing Virtual Machines is changed. We will use a CSV or excel file to import the list of VMs and then will perform snapshot on those VMs with vSphere PowerCLI.

Prerequisites:
1. List of VMs written in CSV file in the given/supported format
2. VMware vSphere PowerCLI

Preparing the CSV file:

In the CSV file, write the name of Virtual Machines in sequence under “Name” column as shown below:













Note: My CSV file contains two Virtual Machines (VM-1 and VM-2). You can add more VMs name as per your requirement.


Steps:
Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

Import-Csv D:\VMsList.csv | %{Get-VM $_.Name} | New-Snapshot -Name TestSnapshot -Description TestDescriptions


IMP Note: Change the following as per your convenience

Path: D:\VMsList.CSV (Change it to your CSV file path)
Name: TestSnapshot (Change the name of the snapshot as per your requirement)
Description: TestDescriptions (Change the description as per your requirement)

Once the command is completed, it should look like below:










Do not worry about the yellow warning appearing below the command. Snapshots of the virtual machines covered in the CSV file already initiated.





Cheers, please write me back if you have any query or feedback on this.

Thursday, 16 February 2017

Taking multiple VMs snapshot – VMware vSphere PowerCLI

Or, How to create multiple VMs snapshot?
Or, How to take snapshot of multiple VMs at once?
Or, Command for taking multiple VMs snapshot.
Or, Taking snapshot of multiple VMs at once.

Descriptions: When you think of snapshot of virtual machines, its easy if you are doing it for one or two machines but its easiest when you thinking to do it for multiple VMs, may be 10-20 or more VMs. Yeah, correct, its was not a typo. J Its even easiest to take snapshot of multiple virtual machines.

The only thing you need is, VMware vSphere PowerCLI.

There are two methods that I use frequently for taking snapshot of multiple virtual machines:

1. Setting up $VMs parameter pointing to the list of virtual machines and then using New-Snapshot cmdlet
2. Typing VMs name manually and then using New-Snapshot cmdlet

Let’s see how?

Steps (Method-1): Setting up $VMs parameter pointing to the list of virtual machines and then using New-Snapshot cmdlet

Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

$VMs = Get-VM VM1, VM2, VM3, VM4


Note: replace VM1, VM2, VM3, and VM4 with your Virtual Machines name. You can add more VMs name here after coma (,).



Now, run the below command and hit enter to start the snapshot process:

New-Snapshot -VM $VMs -Name NameOfSnsphot -Description DescriptionOfSnapshot






That’s it, all VMs (VM1, VM2, VM3, and VM4), now would be having a snapshot.

Steps (Method-2): Typing VMs name manually and then using New-Snapshot cmdlet

Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

New-Snapshot -VM VM1, VM2, VM3, VM4 -Name NameOfSnsphot -Description DescriptionOfSnapshot

Note: replace VM1, VM2, VM3, and VM4 with your Virtual Machines name. You can add more VMs name here after coma (,).







Cheers, Please write me back if you have any query or feedback..