Friday, June 17, 2011

Adding users automatically to SAM database and then to VDI Console

While doing our project, we came to a position where we needed to have abt 40-50 users in SAM database and to add them using GUI would be a very lengthy process.

So we decided to use command prompt.

All you have to do is to create a .BAT file and add the following command to it.

net user (username) (password) /add /comment:"Test user, DELETE ME"
net user Rahul abcd /add /comment:"Test user, DELETE ME"

So, add the user names and passwords below one by one and run the bat file. All will be added.

To remove them, again create a .bat file and use this command.

net user Rahul /delete

So, we just created the file, added 20-30 lines with username and password and got them added to database.

Now to add users automatically, prepare a file with the names of users to be added to VDI Mgmt Console and then provide it as input in the script. One example of such script is:-

$fileinput=Get-Content 'C:\Users\zed\Desktop\input.txt'
foreach($i in $fileinput)
{
add-adminuser -DisplayName $i -UserName $i -DomainName localhost
}


For removing users from SAM database, you need to provide him the simple remove.bat file with remove command for all users and he can successfully remove all the user accounts.

Remove VHost from VDI

For this, the commandlet specified is:-
Remove-VHosts -Name -VirtualizationType -VirtualizationProductType

One can provide different virtualizationtypes and virtualizationproducttypes supported.

One example with image is:-

Delete DesktopCenter form VDI via Powershell

For deleting the Desktop Center, pscmdlet defined and used is:-
Remove-DesktopCenter -VirtualizationType -VirtualizationProductType -Name

A sample command with output is shown in image:-

Retrieving ManagedDesktops via Powershell

For retrieving the managed desktops, the pscmdlet provided by us is:-
Get-ManagedDesktops

This commands lists all the managed desktops available and returns the response object.
$x=get-manageddesktops
$x.listofMD
$x.listofMD.count

 

How to retrieve the list of MDPools

For this, the input parameter is DesktopCenter. According to particular datacenter, it will return the list of MDPools associated with it.

Method coded for this is:-
Get-MDPools -DataCenter (Provide here the datacenter)


To get the datacenter, use this command:-
Get-DesktopCenters -VirtualizationType (specify here) -VirtualizationProductType (Specify Here)

One example is:-
$x=get-desktopcenters -VirtualizationType parallels -VirtualizationProductType parallelscontainer
$y=get-mdpools $x.listofMDPool





How to retrieve DesktopCenters from VDI Management Console

First, go through this post about how to retrieve VHost.
http://automationofvdi.blogspot.com/2011/06/how-to-retrieve-vhosts-in-vdi.html

Now we have a pscmdlet for desktopcenter:-
Get-DesktopCenter -VirtualizationType -VirtualizationProductType

 Now for VirtualizationProductType, use get-VirtualizationProductType and for virtualizationType use get-VirtualizationType.

Now specify them in the particular order and you will get the DesktopCenters linked with it.

$x=Get-VirtualizationType
$y=Get-VirtualizationProductType
$x=Get-DesktopCentres $x[1] $y[1]


How to retrieve VHosts in VDI Management Console via Powershell


As per the code written by us, the pscmdlet for this is:-

Get-VHost -VirtualPlatform -VirtualizationProductType

So one can use this to get the VHosts.
For VirtualPlatform, we have created a method which gives the list of all the available VirtualizationPlatform that can be used and one can create an object of it and use that object as a parameter passed to the commandlet.

Get-VirtualPlatform

Similarly, for VirtualizationProductType we have the method

Get-VirtualizationProductType

So combined, we can use these to get the list of VirtualHosts. One example is:-

$x=get-virtualplatforms
$y=get-virtualizationproducttype
$z=get-vhosts -VirtualPlatform $x[0] -VirtualizationProductType $y[0]
$z.listofVH



Wednesday, June 15, 2011

SYSTEM ARCHITECTURE OF VDI.....


It consists of a physical machine which is responsible for holding the virtual machines which will act as clients. Access to the clients is provided through the connection broker whose task is to keep a check on virtual machines like which machine is on, what is the status of the machine and to check which machine is to be allotted to which customer

. It make a list of the machine not in use for a long time (idle) and turn them off so that the power can be saved.

Architecture Comprises Of Five Main Sections:-

1. Virtualization server/hypervisor

2. Connection Broker

3. Management Console

4. Database

5. Client

Physical Machine

  • Physical Machine having Windows Server 2003 SP2 Enterprise Edition as Operating System.
  • On Windows Server 2003 SP2, We will Install Parallel Virtuoso in which various containers can be created with specified configuration.
  • Depending on the parameters passed by the client to the methods, we can virtual machines of required specification.
  • Containers are the synonym of Virtual machine.

Connection Broker

It acts as a linker.

It allots Virtual Machine (Container) to the Client.

Connection Broker Comprises of two main components.

1) Management Console:-Which helps to centrally monitor the various Virtual Machines Created.

2) Database:-Keeps the information about each and every Virtual Machine. For Example: - It has a list of Unique Identification no. of VMs.

Database and Client

To keep an account of all Virtual Machines, we have used SQL SERVER or SQL Express as our Database Manager.

Client, as per requirement, will pass parameters like amount of space to be allocated or ram to be assigned, to cmdlets of PowerShell.

Every VM must have its Entry (Unique Identity Number) in Database.

Virtual Desktop Infrastructure:-

VDI provides the end user with a virtual PC that looks and behaves exactly like their current PC either working at the office or at home. The user’s profile and files are stored centrally so there is no need to store files specially.

For IT, VDI provides the ability to consolidate the number of servers supporting desktops resulting in cost saving. Additional cost savings come from central management and deployment of applications and updates, eliminating mundane trips to the user’s desk for break/fix improving the work experience for IT and Helpdesk personnel.

Requirements for Installation



1. One requires 2 Machines with Windows Server 2003/2008 R2 OS.

2. On one machine, install ParallelsVirtuozzo containers which can be downloaded from Parallels website. This machine will become
the Virtualization Host on which we can host 'n' number of Virtual machines.

3. On the second virtual machine, you need to install a number of things. They are:-
A. .Net framework 3.5 SP1.
B. IIS Installed on Windows Server.
C. SQL Server database.
D. Connection Broker provided by Propalms Network. The setup itself consists of SQL Server incase you don't have it.
E. VDI Management Console provided by Propalms Network available at their website www.propalmsnetwork.com .

This machine will act as connectionbroker.

So these two machines will work together for the setup of Virtual Desktop Infrastructure.


4. You can install Propalms VDI Client on the individual desktops to use the setup.

Tuesday, June 14, 2011

List Of Completed Cmdlets

List of COMPLETED cmdlets (and classnames)

1.Get-AdminLogin--(admlogin)

2.Get-adminusers--(getusers)

3.Remove-AdminUser--(removeuser)

4.Add-AdminUser--(adduser)

5.Get-Clients--(getclients)

6.Get-Domainclients--(getdomainclients)


7.Get-VHosts--(getvirtualhosts)

8.Get-DesktopCentres--(getDC)

9.Get-ManagedDesktops--(manageddesktop)

10.Get-AdminSessions--(adminsess)

11.Get-UserSessions--(usersess)

12.Get-MDPools--(manageddesktoppools)

13.Get-AdminLogs--(adminlogs)

14.Get-UserLogs--(userlogs)

15.Remove-DesktopCenter--(removedesktopcenter)

16.Remove-Client--(removeclient)

17.Remove-VHosts--(removevhosts)

18.Remove-MDPool--(removemdpool)

19.reset-ManagedDesktop--(updatemanageddesktop)

20.Get-AdminLogout--(admlogout)

21.Add-VHosts--(addvhost)

22.Get-VirtualizationTypes--(virtualizationtypes)

23.Get-VirtualizationProductTypes--(virtualizationproducttypes)

24.Get-VirtualPlatforms--(virtualplatforms)

25.Get-DCHost--(getdchost)

26.Assign-VHosttoDC--(assignvhosttodc)