Friday, 10 April 2020

VMWARE - HOW TO FIND THE SIZE OF VRA POSTGRES DATABASE

VMWARE - HOW TO FIND THE SIZE OF VRA POSTGRES DATABASE

 

Please follow the below steps to find out the size of the VRA Postgres Database

 

1) Login to the VRA appliance via putty and connect it via root account.

 

2) Now switch to the user postgres by typing in the command:-

 

Command:-  su postgres   


3) Now type in the command to connect to database.


Command:- psql vcac


4) Now to check the size of the VRA Postgres database, type in the command and press enter:-

  

Command:-

SELECT
   pg_database.datname,
   pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database;


5) This would show you the current size of the VRA Postgres Database.



Sunday, 5 April 2020

STEP BY STEP PRACTICALS - POWERSHELL - HOW TO FIND THE UPTIME OF SERVERS VIA POWERSHELL (IN DOMAIN)

POWERSHELL - HOW TO FIND THE UPTIME OF SERVERS VIA POWERSHELL (IN DOMAIN)


 We can get the uptime of multiple servers from powershell at the same time. In my example, I will be finding out the uptime of 2 servers which are part of a domain from a single computer.

Please follow the below steps to perform the same:-


1)  I have created a text file name Servers.txt which has the name of all the 2 servers and as an example, I am keeping it in C drive which will be restarted.

 


2) Now I have created a variable $vmlist and will store the contents of the file Servers.txt which is kept on the location C:- Servers.txt. This needs to be done from power shell.




 Note:- In my case, I am running from domain administrator account.


 3) You can check the Content of the file Servers.txt by running the below command:- 


Command:- echo $vmlist


4) Now to find out the uptime of the servers,type in the below command from one of the remote computers. In my example, I am doing it from the DC.


Get-WmiObject win32_operatingsystem -ComputerName $vmlist| select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}

Output is:-


STEP BY STEP PRACTICALS - POWER-SHELL - HOW TO REBOOT THE SERVERS VIA POWERSHELL (IN DOMAIN)

POWERSHELL - HOW TO REBOOT THE SERVERS VIA POWERSHELL (IN DOMAIN)


 We can reboot multiple servers from powershell at the same time. In my example, I will be rebooting 2 servers which are part of a domain from a single computer.

Please follow the below steps to perform the same:-


1)  I have created a text file name Servers.txt which has the name of all the 2 servers and as an example, I am keeping it in C drive which will be restarted.

 


2) Now I have created a variable $vmlist and will store the contents of the file Servers.txt kept on the C Drive which has the names of the Servers which will be re-started. This needs to be done from power shell.




 Note:- In my case, I am running from domain administrator account.


 3) You can check the Content of the file Servers.txt by running the below command:- 

Command:- echo $vmlist


4) Now to reboot the servers,type in the below command from one of the remote computers. In my example, I am doing it from the DC.

Command:- Restart-Computer –ComputerName $vmlist -Force -Verbose



 

The Force parameter causes an immediate restart of each computer.
The Verbose parameter tells you what has been done.



 5) Out of running the above command:-




STEP BY STEP PRACTICALS - VMWARE - HOW TO CREATE A SNAPSHOT FROM VMWARE POWER CLI

VMWARE - HOW TO CREATE AND REMOVE A SNAPSHOT FROM VMWARE POWER CLI

 

Please follow the below steps to create snapshots via VMware Power CLI.

 

1) Connect to the VC by running the below command:-

Command:- Connect-VIServer IP Address of the VC of FQDN or the VC.

 

 

 

2) This would prompt you to Enter the Username and Password of the Virtual Center.

 

 

3) Once you are connected, it would show you the below prompt:-

 

 

4) You can get the list of all the VM by running the below command:-

 

Command:- Get-VM

 

 

5) In my example, I want to take the snapshot of all the 3 VM.

So to perform this, I will create a text file name Servers.txt which has the name of all the 3 servers and as an example, I am keeping it in C drive.

 

 

 

6) Now I have created a variable $vmlist and will store the contents of the file Servers.txt kept on the C Drive which has the names of the Servers for which we want the snapshot.

 

$vmlist = Get-Content C:\Servers.txt

 

7) You can check the Content of the file Servers.txt by running the below command:-

 

Command;- echo $vmlist 


 

8) Now to Create the snapshot you can run the below command:-

 Command:-  New-Snapshot -VM $vmlist -Name "$($vm.Name)_SNAPSHOT1" -description 'TEST-SNAPSHOT1' -Quiesce -Memory -Verbose

 

 9) The snapshot can be verified by going the going to the VC.

You can also check the same by running the command:-

Command :-  Get-Snapshot -VM $vmlist -Verbose

 

10) You can remove all the snaphsots for the servers - test1, test2 and test3 by running the below command:-

Command :- Get-Snapshot -VM $vmlist | Remove-Snapshot -Confirm:$false -Verbose



11) Now if you run the command to check the snapshots, it would not show you any snap-shot as it has been removed.