Wednesday, February 27, 2013

Click the PVS Target Device Optimizer button with AutoIt

Short but sweet script.  Disappointing that Citrix doesn't have a silent run switch for this application.

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT
; Author:         Trentent Tye (trentent@ca.ibm.com)
;
; Script Function:
;   Execute the OK button on the Provisioning Services Device Optimization Tool program
;

; Wait for the Provisioning Services Device Optimization Tool to become active
WinActivate("Provisioning Services Device Optimization Tool")

;pause 3 seconds
Sleep(3000)
;click OK
ControlClick("Provisioning Services Device Optimization Tool", "", "[CLASS:Button; TEXT:&OK; INSTANCE:1]")

; Finished!

Monday, February 25, 2013

AppV 5 Precache script

This script will go through and clear all AppV 5 packages then resync with a Streaming/Publishing server and then download the package locally to the server.


:: ===========================================================================================================
::
:: Created by:        Saman Salehian
::            Intel Server Team
::            IBM Canada Ltd.
::
:: Creation Date:    Oct 16, 2012
:: Modified Date:    Feb 25, 2013 -- Saman Salehian & Trentent Tye - Added load all applications sequentially - App-V 5
::
:: File Name:        AppV_Data_PreCache.cmd
::
:: Description:        Pre-Cache App-V Applications/Packages on XenApp Server
::
:: ===========================================================================================================

@ECHO OFF
CLS
 ================================================================================
:: Load all applications sequentially - App-V 5
:: ================================================================================
IF EXIST %SYSTEMROOT%\SysWOW64\notepad.exe (
    >Appv5ClientRefresh-01.ps1 ECHO.
    >>Appv5ClientRefresh-01.ps1 ECHO Import-Module AppVClient
    >>Appv5ClientRefresh-01.ps1 ECHO Remove-AppvClientPackage *
    >>Appv5ClientRefresh-01.ps1 ECHO Get-AppVPublishingServer ^| Sync-AppvPublishingServer 
    >>Appv5ClientRefresh-01.ps1 ECHO Mount-AppvClientPackage *
    "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
    "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" .\Appv5ClientRefresh-01.ps1
    "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
    DEL /F /Q Appv5ClientRefresh-01.ps1 >NUL
)

KMS issue with PVS after an Office install

We use Citrix Provisioning Services (PVS) 6.1 and it has been working well for us in our Citrix XenApp environment.  We could make versions, promote and patch without issue with our KMS servers.  Then, we installed Office 2010 with KMS and now each time we make a version of our vDisk, then promote to test or production KMS becomes broken.  Windows doesn't allow RDP sessions until it's resolved so this seriously borks our setup.

A fix I read on this thread was to create a startup script that reinstalled the product key (as this key seems to go missing when promoting versions) and reactivate.

The script is as follows:
cscript //B "%windir%\
system32\slmgr.vbs" /ipk YC6KT-GKW9T-YTKYR-T4X34-R7VHC
cscript //B "%windir%\
system32\slmgr.vbs" /ato
For a simple test to see if this works I've added it to the machine startup script on the local system here:
C:\windows\system32\GroupPolicy\Machine\Scripts\Startup


Thursday, February 21, 2013

AppV 5 issues

We are having issues with AppV 5.  Suddenly, after enabling global refreshes the application we were publishing was having major problems.  From everything I have seen the publishing server and management server were operating correctly, the client appeared to be operating correctly but I kept getting these types of errors on the client:

"Package {571b8b47-d4ba-491e-a824-6b64260a8205} version {2ccba72b-ef64-4041-a2c3-d24768165b69} failed configuration in folder 'D:\AppVData\PackageInstallationRoot\571B8B47-D4BA-491E-A824-6B64260A8205\2CCBA72B-EF64-4041-A2C3-D24768165B69' with error 0x4FC01304-0x80070003."

"Error encountered while executing command Get-AppvPublishingServer | Sync-AppvPublishingServer. Error: There were errors encountered when trying to publish packages from the server.
Operation attempted: RefreshPublishingServer. 
AppV Error Code: 070000000B. "

To resolve the issue I needed to execute:

Remove-AppvClientPackage *
Get-AppvPublishingServer | Sync-AppvPublishingServer

On the client

Friday, February 01, 2013

Powershell script to find user login times

With Windows Server 2008 and on the event log "Group Policy" will track how long it takes a user to login. I've created a script that will pull all this information into a file.


=================List-of-comps.txt======================
Server1
Server2
Server3
Server4

$comp = import-csv "C:\list-of-comps.txt"
foreach ($entry in $comp) {(get-winevent -listprovider microsoft-windows-grouppolicy) |get-winevent -computername $entry.comp |where {$_.id -eq 8001}| format-table timecreated, message -auto | out-file -append "C:\Users\trententtye\Desktop\New Text Document (2).txt"}