Monday, May 14, 2012

Powershell and Citrix:Citrix Support for PowerShell.

 

“The only thing that interferes with my learning is my education”.-Albert Einstein

 

In the earlier Blog Post , Our System got up and ready for Using Citrix PowerShell SDK to manage our Farms.

But before going any further it is important to know about the appropriate Citrix PowerShell SDK you would be using along with any limitations.

Now for the Older Citrix Product like XenApp 5.0 and Presentation Server 4.5, the management was done using MFCOM but Microsoft and partners are pushing PowerShell as the new console-based management and automation tool. This doesn’t came as a shock when Citrix ( M$ partner ) decided to support PowerShell.

New Citrix Products XenApp 6.0 and XenApp 6.5 are provided with a PowerShell SDK.But the XenApp 5.0 and Presentation Server 4.5 Admins needn’t to settle for less, Citrix provides the XenApp Commands CTP for these older release. Any version below Presentation Server 4.5 can’t be used with PowerShell.

Let’s delve into these one –by-one and try to explore the functionalities provided with each of them. I have used the Citrix Community Sites for this information and I may have have misunderstood few things….feel free to correct me any time.

Targeted Platforms

Pre-Requisite

Citrix XenApp Commands CTP

This Tool Pack runs on the following platforms:

· XenApp 5.0 for Windows Server 2008 x64.

· XenApp 5.0 for Windows Server 2008 x32.

· XenApp 5.0 for Windows Server 2003 x64.

· XenApp 5.0 for Windows Server 2003 x32.

Following platforms were not targeted for this Tool Pack, but might be functional:

· Presentation Server 4.5 for Windows Server 2003 x64 with HRP3 installed.

· Presentation Server 4.5 for Windows Server 2003 x32 with HRP3 installed.

· PowerShell v 1.0 or later

· .NET Framework 3.5 SP1

XenApp 6 PowerShell SDK

· XenApp 6 for Windows Server 2008 R2 x64.

(PowerShell Remoting used)

· MSI 3.0

· PowerShell 2.0 + WMF 2.0

· .Net 3.5 SP1

XenApp 6.5 PowerShell SDK

· XenApp 6 for Windows Server 2008 R2 x64.

(Citrix Remoting feature used)

· Any Windows Client with PowerShell v2.0 (PowerShell Remoting used)

  • MSI 3.0
  • PowerShell 2.0
  • .Net 3.5 SP1

**********************************

XenApp Commands Technology Preview

These commands are a PowerShell Tool Pack that allows managing most aspects related to XenApp.  They cover all of MFCOM functionality for features available in XenApp 5 and include functionality from both AMC and CMC.  The Commands target XenApp 5 for both W2K8 and W2K3.

This Tech Preview is now open to everyone with a MyCitrix account. The current tool pack is CTP3, and you can read the Release Notes at :

https://www.citrix.com/site/resources/dynamic/dlshareddocs/XenApp_Commands_CTP3_Release_Notes.htm

Note! This tool pack is provided without any warranty.

Features with CTP

This release provides the following management functionality that is provided by the Access Management Console’s Presentation Server extension e.g.  Application publishing, Farm and Server configuration etc. This release also includes features of XenApp Advanced Configuration:  Policies,  Printer Management,  Load Management

This release does not cover functionality outside the scope of those components, such as Hotfix Management, Report Center, Licensing and Diagnostic Facility features.  Features that were removed during the XenApp 5.0 release are also not supported, such as Resource Manager and Monitoring Configuration.

**********************************

XenApp 6 / XenApp 6.5 PowerShell SDK

Both of these SDKs have standard modules, these were already explained in previous post.

· Citrix XenApp Commands

· Citrix Group Policy Provider

· Citrix Common Commands

There are few more features that are shipped with XenApp 6.5 PowerShell SDK which are not available with XenApp 6.0..But I think Citrix provides free upgrade from XenApp 6.0 to XenApp 6.5 (using a PowerShell based uitilty..this was obvious right ? ) So it’s better to go with XenApp 6.5 to use all the features.

The most distinguishing feature in XenApp 6.5 SDK is

Remoting :All the cmdlets now support a -ComputerName parameter which indicates to the cmdlet to execute remotely. This means that the snap-in now can be installed anywhere and no additional configurations are needed in the client or server , so you can use any Windows Client with PowerShell 2.0 and manage the Farm.

To accomplish this feature, a new WCF service (Citrix XenApp Commands Remoting) was introduced in XenApp, which takes care of all the business.

Apart from Remoting , there is also feature to set default computername for remoting and using Object Ids , will try to cover these later.

So I am using a Lab Environment having XenApp 6.5 and the proper SDK installed , in next post will use PowerShell Remoting to perform simple tasks.

Thanks

Deepak Singh Dhami

Deepak Singh

Friday, May 11, 2012

Powershell and Active Directory: Find the group memberships of a Domain User using PowerShell.

 

Hi,

I hope that you guys are enjoying our "Powershell and Active Directory" series. Today for some reason i need to find the group membership of a domain user and send the list of all of that detail to my IT Manager.

Normally we open "DSA.MSC" or "Active Directory user and Computers" , search the user, go to his user account properties , find the membership tab and note/write down the list of his all group membership to a paper then put it to a Excel. If a user is subscribed to 100 of groups then? Obviously we "IT peoples are know for our laziness"  we are not going to do it ,, I am right isnt? .

Then i thought let's do it again with PowerShell. :)

we are using Get-ADUser cmdlet to get the membership of the group of a particular user.

Lets Start.

 Make sure you have "RSAT" installed on you laptop.

Now Import the Active Directory module.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

..

ok, Module is imported,,

ok now run Get-ADUser cmdlet with username of the user whose Group Membership you want to see.

Get-ADUser Aman.Dhally

11-05-2012 13-34-37

Ok..it's not showing the Group member list.. it wont until in -Properties we select the MemberOf property of Get-ADUser

Run the below command it will show you the list of all properties which domain user "aman.dhally" have.

Get-ADUser Aman.Dhally -Properties *

You will notice that it also have the MemberOf property.

11-05-2012 13-41-02

lets access only MemBerOf property of domain user using Dot(.) notation and grouping.

The below command show us only the Domain user "MemberOf" property.

(Get-ADUser Aman.Dhally -Properties *).MemberOf

this will give you the detailed list of Group membership in LDAP like pattern, like

CN=Singers,OU=Demo4,OU=Groups,DC=XYX,DC=com
CN=Songs,OU=Demo3,OU=Groups,DC=XYZ,DC=com

If you are happy with this that is OK,, but then you have to remove all clutter manually ...   "CN" is contains our group name .. let's filter it more using Powershell.

11-05-2012 13-51-06

You can see  above the output of MemberOf is separated by Comma (,) let's split the output using -Split  parameter.

(Get-ADUser Aman.Dhally -Properties *).MemberOf -split ","

11-05-2012 14-34-49 

Ok.. now what???, now we need to select only CN names,,, Simple.. we can use Select-String cmdlet to select only CN Names...

(Get-ADUser Aman.Dhally -Properties *).MemberOf -split (",")  | Select-String -SimpleMatch "CN="

11-05-2012 14-38-30 

Great.. Now it showing only Name of the our Groups. but it have "CN=" in the from of it...

Do you want to filter more ???

Yes, Ok..

Lets replace "CN=", with nothing,, we can use -Replace parameter .. To user -Replace paramter we need to put above command in to Subexpression and after SubExpression we can use -Replace Parameter.

$((Get-ADUser Aman.Dhally -Properties *).MemberOf -split (",")  | Select-String -SimpleMatch "CN=") -replace "CN=",""

Wow , finally i have the clean, filtered list of my domain user group memberships.

11-05-2012 14-44-15

Hope you like it..

Happy Weekends.

Thanks

Aman Dhally

Aman Dhally

Wednesday, May 9, 2012

Powershell and Active Directory: Find Active Directory Replication Servers using Powershell.

 

Hi,

Today my IT manager give me the task to find and create the list of all "Active Directory Replication Server". First i was thought to find it using "Active Directory Sites and services" then i thought lets try to find it using PowerShell our favourite tool.

i use Get-ADDomain tool cmdlet to find the list of Replicated server.

 Make sure you have "RSAT" installed on you laptop.

Now Import the Active Directory module.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

Lets run the Get-ADDomain cmdlet

It shows a lot of information regarding your current domain.  Like Forest, Child Domains, Parent Domain etc., but we are interested in "ReplicaDirectoryServers"

09-05-2012 12-56-27

we have to use Dot(.) notation to show the list of all servers in "ReplicaDirectoryServers"  property.

(Get-ADDomain).ReplicaDirectoryServers

Finally, now we have the list of all of our "ReplicaDirectoryServers" ..

09-05-2012 12-59-05 

Thanks for reading ..

Hope it may help someone...

Aman DhallY

Monday, May 7, 2012

Powershell and Citrix: Installing Citrix PowerShell SDK on XenApp Server/or Windows Client

written by: Deepak Singh Dhami.
"A teacher who is attempting to teach without inspiring the pupil with a desire to learn is hammering on cold iron" 
Hello Power Users!
When I started learning Citrix, I was very excited about the fact that Citrix provides PowerShell SDK to manage the XenApp Farms.  One has to install the SDK in the Remote XenApp Server or the local machine to start using PowerShell cmdlets to manage the Farm. These cmdlets provide extra functionality not achievable from the GUI.
In this post we will get our system ready for using Citrix SDK. 
Getting the System Up and Ready for Action:
********************************************************************

Installing Citrix PowerShell SDK on XenApp Server/or Windows Client.
First of all get the appropriate SDK for your Server. I have a XenApp 6.5 Server running in my Environment. So I downloaded appropriate one ...Note here that the functionality may be limited with the version of XenApp and PowerShell SDK you are using (will discuss this at length in later post). 
You can download the Citrix PowerShell SDK by using following link:
For Citrix XenApp 5.0 (in Windows 2008 and 2003), you'll need to register yourself to get this one. 
 For Citrix XenApp 6.0,
For Citrix XenApp 6.5,
Run the Installer executable on a Client or XenApp Server to be presented with a License Agreement.
You know what to do here… ;)
I mean read the whole license here…...C'mon who does that :P
clip_image002
    Figure 1 
Now after the tiresome reading of the Agreement. You'll be presented with a Screen like Figure2:
The components that will be installed with the Citrix PowerShell SDK are explained as below: 
Citrix XenApp Commands
These cmdlets expose a consistent command line and scripting experience for XenApp Farm Admins. Note that all the Farm Management tasks can be performed using the cmdlets and moreover these cmdlets provide functionality that is not provided with a traditional GUI that is Citrix Delivery Services Control / Citrix App Centre. 
Citrix Group Policy Provider
The Citrix Policy provider lets you examine, edit, clear, and copy policies and policy settings that are stored in any GPO. When the provider is loaded, it creates the LocalGpo and LocalFarmGpo drives to refer to the local Windows policy and any Citrix policy that is applied to the XenApp farm where the server is a member.
Citrix Common Commands
The Citrix Common Commands provide functionality common to all Citrix products. The Common Commands are exposed through the snap-in: Citrix.Common.Commands. 
clip_image004
         Figure 2 
Installation Complete 
clip_image006
    Figure 3
I am using the XenApp 6.5 SDK and it comes with a new feature called Remoting. Note this Remoting is different than the PowerShell Remoting.  
Note:  I will be covering two scenarios in upcoming blog posts
1.      Using PowerShell Remoting
2.      Using Citrix Remoting
Stay tuned for more citrix related stuff...
Thanks
Deepak Singh Dhami
Deepak Singh 

Friday, May 4, 2012

Powershell and ActiveDirectory:Find the settings of your default Domain Password Policy using Powershell.

 

Hi,

Sometimes we need to know what is our default domain password policy is set to?. Is Complexity of password is enabled?  what is minimum password length is set to.

Normally to check these setting to need to open your Group Policy Console and go to domain setting etc.

But in Powershell to see these settings are very simple. These Settings are just a CMDLET away.

Make sure you have "RSAT" installed on you laptop.

Lets Start.

Import the Active Directory module first.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

After importing the Module, we are going to use Get-ADDefaultDomainPasswordPolicy cmdlet. Simple.

Run the Get-ADDefaultDomainPasswordPolicy cmdlet and it will show you all domain Password Policy related settings.. Simple :)

04-05-2012 20-16-41

Happy Weekend....

Thanks

Aman Dhally

Aman Dhally

Thursday, May 3, 2012

Powershell and Active Directory : Find all members of the Group using Powershell.

 

Hi,

Today our target is to find all members of particular group. We know the Group Name and we are going to get the list of all of his members.

we are going to use Get-ADGroupMember cmdlet. This command only available if you have RSAT tool installed and loaded the "ActiveDirectory" Module.

Lets Start.

Import the Active Directory module first.

Import-Module ActiveDirectory

30-04-2012 23-21-03

After importing the Module, we are going to use Get-ADGroupMember cmdlet.

After Get-ADGroupMember cmdlet provide the name of the group it shows list of all of his members , them after Piping we are using Select cmdlet to show only names of the members.

Get-ADGroupMember .Systems_Manchester | Select Name

03-05-2012 11-30-56

Sorted :) , Simple ..

Thanks for reading .

Aman Dhally

avatar-295

Wednesday, May 2, 2012

Powershell and Active Directory: Find all distribution groups in AD with their Email-ID along with the date of creation using Powershell.

 

Hi,

Today i got task from my IT Manager to create a list of all distribution group in our AD along with there Email-Id's also he required the date of creations of those distribution groups.

I thought lets try this with PowerShell. I was planning to use Get-ADGroup cmdlet to fulfil my purpose. This cmdlet only available if you have  "RSAT" installed on you laptop.

Lets Start.

Import the Active Directory module first.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

After importing the Module, we are going to use Get-ADGroup cmdlet.

To view all the group n your Active Directory we can use below command. This will show all the Groups.

Get-ADGroup -Filter *

02-05-2012 15-06-02

Lets filter the output and choose to view only "Distribution Groups"

Get-ADGroup -Filter 'GroupCategory -eq "Distribution"'

So we have the the list of distribution Groups. but our purpose is still not resolved. now we need Mail and Date of creation of these Groups.

02-05-2012 15-11-10

To view the mail, creation date we need to add -Properties *  to the  Get-ADGroup cmdlet.

Get-ADGroup -Filter 'GroupCategory -eq "Distribution"' -Properties * | select Name,mail,whenCreated | ft -AutoSize

02-05-2012 15-25-28 

All Sorted, our purpose is fulfil. If required we can also export the out to .CSV or .TXT format.

I Hope that it helps someone.

Thanks

Aman Dhally

spiderlove02