Friday, February 27, 2015

Working with Powershell locked down? Unlock it…

 

If the machine you are running on and locked down there are several options to running the scripts shown below.

image

Via PowerShell - Get-Content AScript.ps1 | Invoke-Expression

image

Via DOS (note the spurious characters coming from the piped file) – TYPE AScript.ps1 | PowerShell.exe -noprofile

image

Or via a script to disable the execution policy by removing the AuthorizationManager in the current PowerShell session:

function Disable-ExecutionPolicy {($ctx = $executioncontext.gettype().getfield("_context","nonpublic,instance").getvalue( $executioncontext)).gettype().getfield("_authorizationManager","nonpublic,instance").setvalue($ctx, (new-object System.Management.Automation.AuthorizationManager "Microsoft.PowerShell"))} Disable-ExecutionPolicy

image

I found this here: –> https://blog.netspi.com/15-ways-to-bypass-the-powershell-execution-policy/

Wednesday, February 25, 2015

Citrix PVS device BSOD 0x0000007B via SCCM build

 

image

After installing the Citrix PVS Target Device software via SCCM or some other command line tool the Provisioning Services Target Device software:

%drive%\%folder%\PVS_Device_X64.exe /s /v /qn /norestart

What can happen is via the command line installation (not via the GUI) the files are not copied to the correct place. The quick fix is after the install, via a new command line:

Copy “C:\Program Files\Citrix\Provisioning Services\drivers\*.*”  to “%windir%\System32\Driver”

Then copy the image to the PVS and good to go.

 

 

"Dave Colvin"

Wednesday, February 18, 2015

PVS Automation with PowerShell

 

The script support installs when you install the Desktop Delivery Controller and PVS console.

  1. Install the Desktop Delivery Controller and PVS consoles (or the powershell MSIs)
  2. Add-PSSnapin *Citrix*,*PVS*
  3. Installing Microsoft’s Remote Server Administration Tool(RSAT) Active Directory Support
  4. Import-Module ActiveDirectory

The Provisioning Services cmdlets are installed via a 2 step process.

  1. Run the following command to install the MCLIPSSnapin for the PVS cmdlets:
  2. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Installutil.exe “C:\Program Files\Citrix\Provisioning Services Console\MCLiPSSnapin.dll”
  3. Add-PSSnapin MCLiPSSnapin

Now you have come this far some interesting commands:

Get all Devices in

Mcli-Get Device

Get devices in collection

MCLI-Get Device -p collectionName=”COLLECTIONNAME”,siteName=”SITENAME”

Add a device

MCLI-add Device –r devicename=xxxx1, deviceMac=00-xx-00-xx-00-xx, description=”something”, collectionName=”coll name”, siteName=”your site”

Get device details

MCLI-get Device –p devicename=xxxx1

Delete a device

MCLI-delete Device –p devicename=xxxx1

Add existing vDisk to store

MCLI-Add diskLocator -r diskLocatorName=”VDISKNAME”,siteName=”SITENAME”,storename=”STORENAME”

Add the target device to its device collection and create a computer object

Mcli-Add Device -r deviceName=$VM_Name, collectionName=$collection, siteName=$site_1, deviceMac=$MAC, description=$description, copyTemplate=1
Mcli-Run AddDeviceToDomain -p deviceName=$VM_Name, organizationUnit=$OU

Tips and Trick for Citrix PVD

 

  • Is PvD compatible with XenApp?
  • No only XenDesktop

 

  • Is a PvD the same as a differential disk?
  • No, PvD operates at the object level (files, folders, and registry). This enables all the changes that have been captured to persist across a base image updates whereas a differential disk would become invalidated in the case of a base image update.

 

  • Can multiple PvDs be associated to a device/user?
  • There can only be one PvD per Virtual Machine. The PvD is assigned to a Virtual Machine when building the catalogue of desktops. The pool type for a PvD catalogue is a pooled static, which the desktop is assigned to the user on first use.

 

  • Is the PvD a 1-1 mapping per user?
  • It is a 1:1 mapping to a Virtual Machine in a catalogue (assigned to the user on first use). The administrator can move a PvD to a new virtual machine in a recovery situation.

 

  • If you create a catalogue for pooled with PvD, it does not mean that the user is always required to be assigned to that Virtual Machine defeating one of the benefits of a pooled?
  • The base image is still shared and updated across the pool. However, once the user makes an initial connection to a Virtual Machine, the Virtual Machine is kept assigned to the user.
    Note: You must connect early in the starting stage long before you know who the user is in order to maximise the application compatibility for services, devices etc.

 

  • Should the paging file be captured on the PvD?
  • No. If you try to configure it this way, then the PvD will ignore this and will use the base Virtual Machine image (or Diff disk).

 

  • Do I still require Profile Management?
  • Personal vDisk does not roam. So if you have users that require profile roaming, you must use a roaming profile solution with PvD. It has been tested and supported with Citrix Profile Management.

 

  • Does a PVD roam or is it assigned to single desktop?
  • A PvD is attached to a Virtual Machine or machine, which is then assigned to the user. The administrator might move a PvD to a new machine in recovery situations.

 

  • How do you configure Personal vDisk later if you choose not to enable it during the Virtual Desktop Agent (VDA) meta-installer?
  • Run the inventory updater in the base image through the start menu shortcut (or “Ctxpvd –s inventory”), which results in the service being started or inventory taken. At this point, the service is enabled and ready to run inventory and manage the PvDs.

 

  • Is the drive letter used by PvD able to be hidden?
  • PvD currently uses two drive letters. The v: drive is hidden and is a blended view of the c: drive.
    The P: drive is not hidden.

 

  • I cannot see v: drive; is there a way to see it?
  • v: is only visible at a command prompt window. However, it is a blended view of the c: drive and appears to be identical. There is no way within the OS to see what is really on the base c: drive and what is on the PvD (P: drive).

 

  • Is the UserData.vhd file inside the P: drive mounted as v:?
  • The disk that is attached at the hypervisor is mounted as P:. The P: drive is where the user profile is redirected and captured. Also located on that P: drive is a UserData.vhd that is mounted as v:.
  • The V: drive is where all the non-profile data attempting to write to the base Virtual Machine is redirected and stored. v: is visible from command prompt windows but not from Windows Explorer.

 

  • How do I change PvD to use different drive letters?
  • The P: drive might be changed in Desktop Studio when creating the catalogue. This should only be changed before usage since changing afterwards might lead to various errors (same as changing the c: drive to another letter after installation). 
    The v: drive must be changed in base image before being used in a catalogue:

KEY: HKLM\SOFTWARE\Citrix\personal vDisk\Config

VALUE: VHDMountPoint
Example: V:\

Note: Drive conflicts leads to failures.

  • What is captured on the v: drive and what is capture on the P: drive?
  • The P: drive is the vDisk that is attached to the hypervisor to the Virtual Machine. It contains the user’s profile is redirected (c:\users … ). It also contains the UserData.vhd file that is in turn mounted as the v: drive.

 

  • The v: drive is where the applications and machines state is captured.
  • When resetting the PvD, you are resetting the v: drive (which is really restoring the UserData.vhd file on the P: drive to its original empty or template state.

To reset, the machine with the Personal vDisk must be running; however, the user does not have to be logged on to it.

When you reset the disk, the settings revert back to their factory default values and all data on it is deleted, including applications. The profile data is retained unless you modified the Personal vDisk default (of redirecting profiles from the C: drive).

From the Help Desk view, choose the targeted Desktop OS machine.
From this view or in the Personalisation panel of the User Details view, click Reset Personal vDisk.
Click Reset. After the user is logged off (if the user was logged on), the machine restarts.

If the reset is successful, the Personal vDisk status field value in the Personalization panel of the User Details view is Running. If the reset is unsuccessful, a red X to the right of the Running value appears. When you point to this X, information about the failure appears.

To reset the PvD from the Desktop Director console or run the following command from elevated command prompt on the VM:

“C:\Program Files\citrix\personal vdisk\bin\ctxpvd –s reset”

This would reset all User Data excluding Profile information, so in effect, a user would lose any applications installed.

 

If antivirus products are installed on your desktops, ensure the VHD is big enough to store antivirus definition files, which are typically large.

The presence of antivirus products can affect how long it takes to run the inventory or perform an update.

Target (w7):

  • \Program Files\Citrix\Provisioning Services\BNDevice.exe
  • \Program Files\Citrix\Provisioning Services\TargetOSOptimizer.exe
  • \Windows\System32\drivers\bnistack6.sys
  • \Windows\System32\drivers\CfsDep2.sys
  • \Windows\System32\drivers\CVhdBusP6.sys
  • Exclude scanning of Write Cache

Target – Personal vDisk:

  • \Program Files\Citrix\personal vdisk\bin\CTXPVD.exe
  • \Program Files\Citrix\personal vdisk\bin\CTXPVDSVC.exe
  • \Program Files\Citrix\Personal vDisk\BIN\WIN7\

 

 

http://support.citrix.com/proddocs/topic/xendesktop-7/cds-manage-personal-vdisks.html

http://support.citrix.com/article/CTX131553

https://literallyvirtual.wordpress.com/?s=vdisk

http://blogs.citrix.com/2013/09/22/citrix-consolidated-list-of-antivirus-exclusions/

Thursday, February 05, 2015

Copy a Citrix PVS Versioned Disk

 

If try and just cope the .VHD of a versioned vDisk you’ll get an error message about not disk found. What you need to do is copy more, rename, export and then import.

To simplify the process you can merge the VHD chain of the source vDisk or just copy more files now and do it after? Here is how:

image

  • Copy all the versioned vDisk in the chain (*.vhd, *.ahvd, *.pvp NOT the *.lok)
  • Rename the copied files as required

image

image

  • Open the PVS console, right click the source vDisk, and choose ‘Export vDisk…’

image

  • Choose the latest version in the ‘Export versions starting at’
  • This creates a XML (manifest file) containing the entire information about the versions of that vDisk

image

  • Rename the XML file
  • Edit the XML file change all references of the source vDisk to the copied vDisk name
  • You should have a set of VHD/AVHD/PVP/XML files with the same file name. And an XML which refers to the new VHD files
  • Open the PVS console, right click the vDisk store, and choose ‘Add or Import Existing vDisk…’

image

  • After a short delay a popup appears saying that the import was successful

Job Done.

 

Cheers Dave Colvin

http://dave.colv.in 

http://twitter.com/DaveColvin

Hat tip: http://www.out-web.net/?p=1177

Tuesday, February 03, 2015

Raspberry Pi + Windows 10 = IoT (at home)

 

The new Raspberry Pi 2. 6x the power, 1 GB RAM, Windows 10 support and the same price.

This Broadcom CPU has two distinct improvements over the BCM2835 of the RPi B+. First, it has quadrupled the cores, each running at 900 MHz. (PI B+'s single-core 700 MHz). Also included a small tweak that allowed them to support 1 GB of RAM, double the 512 MB on the other models.

Microsoft announced today that Windows 10 would run on the Pi 2 free for the developer community via the Windows Developer Program for IoT later this year. Windows 10 on the Raspberry Pi 2 will be the IoT SKU of Windows 10, not the full version, but that’s exactly what the device was designed for.

Microsoft says that it sees the developer community as the foundation of the next wave of computing. By offering Windows 10 at no cost Microsoft has guaranteed that Windows 10 will be used in all manner of cheap projects that it would have never been considered for if the OS was selling at prices like previous generations of Windows.

Register with Microsoft. Buy some Pi.

image + image = image

Monday, February 02, 2015

Updated Citrix Receiver 4.2 PNA like experience

 

This is what the new PNA like experience looks like in the Start Menu of Windows 7. You can also get this on the desktop (but I have not shown this).

image

To get this you need to install the 4.2 receiver with the following command line. I cant stress enough how specific the CAPS, format and order this command line is.

Replace the section in yellow with your storefront server, ALSO note the /discover in the command line (see below where you can get this exact link from the Storefront server .CR file).

CitrixReceiver.exe /silent ADDLOCAL="ReceiverInside,ICA_Client,SSON,AM,SELFSERVICE,USB,DesktopViewer,Flash,Vd3d" ENABLE_DYNAMIC_CLIENT_NAME=Yes ALLOWADDSTORE=S ALLOWSAVEPWD=S STARTMENUDIR=\CitrixXenApps\ /INCLUDESSON /STORE0="Store1;https://storefront.COLV.IN/Citrix/Store1/discovery;On;Store1"

REBOOT, you need this as the SSOSVR.EXE needs to be running as seen below.

image

Additionally you need all the following:

  1. TO BE USING HTTPS and a valid Cert.
  2. You need the XML trust in both XenDesktop OR older XenApp
  3. Your StoreFront server needs to be in ‘Local Intranet’ or ‘Trusted Sites’ in IE
  4. Enable “Automatic Logon with current user name and password” is enabled in local Intranet if that is what you are in (see above).
  5. Enable “Automatic Logon with current user name and password” is enabled in Trusted Sites if that is what you are in (see above).

 

Once it works, IE should auto logon as shown below.

image

 

If you don't know the URL above in yellow download the .CR file and it is highlighted below

image

image

 

This is the connection receiver once installed.

image

image

image

 

To get the Start Menu to populate this is the command line. It should do it automatically on reboot.

"C:\Program Files (x86)\Citrix\SelfServicePlugin\SelfService.exe" –showAppPicker

image

Once working correctly the Citrix Receiver in the notification area should logon automatically.

image

 

This is an update from the older article http://davestechnology.blogspot.com.au/2013/12/you-want-back-pna-program-neighbourhood.html

Blog Archive