Home » Scripts, Commands, Registry » Page 2

Category: Scripts, Commands, Registry

Appsense Hiving for users Printers but default not saving?

Situation:

we had migrated our desktop from Xenapp 5.0 on w2008 sp2 (non r2) to XenApp6.5 2008 R2. This included an upgrade to Appsense 8.3 and introduction of Appsense personalisation.

Older applications still left on the old desktop needed the printer settings from the new desktop.

We had to set our new Appsense EM to hive the printer settings to the users home drive. (which was the old way)

Then on the old desktop (which was already hiving) the printers would be imported.

Hiving HKCUPrinters

Printing directly from the old desktop to the printers in question already worked, so it was not driver or server related.

 

Problem:

The old desktop and applications were getting the printers, but some apps would not get any printers and the default printer was not being set correctly.

Solution:

You also need to hive out

HKCUSoftwareMicrosoftWindows NTCurrentVersionWindows

KeyName: Device

Type: REG_SZ

Data: \serverprinter,winspool,Ne00:

Older applications that ccould only see the default printer then worked, as did the default setting of the printer

(Thats assuming that the provided default printer was of course installed, its drivers available etc)

 

Path Examples:

Home Drive

“\servershare\usernameHIVEPATHRegistryPrinters.%domain%__%username%”

“\servershare\usernameHIVEPATHRegistrySoftware{;bks}Microsoft{;bks}Windows NT{;bks}CurrentVersion{;bks}Windows.%domain%_%username%”

 

 

 

PDF Converter Script

Screipt provided will change the password associated with the PDF Printer AMYUNI Documet Converter 400.

This had to be automated as our PVS environment couldnt be updated everytime we wanted to change the devices password company wide.

START SCRIPT—————————————————–

Option Explicit

‘ This VB script can be used to configure the installed printer

Dim PRINTER_NAME

PRINTER_NAME = “PDFPRNxx”

Dim PDF

‘for version 4

Set PDF = CreateObject(“cdintfex.cdintfex”)

‘for version 4.5

‘Set PDF = CreateObject(“cdintfex.cdintfex.4.5”)

PDF.DriverInit (PRINTER_NAME)

‘/*////////////////////////////////////////////////////////////

‘Permission Permission value

‘Enable Printing – 64 + 4

‘Enable document modification – 64 + 8

‘Enable copying text and graphics – 64 + 16

‘Enable adding and changing notes – 64 + 32

‘To combine multiple options,

‘use -64 plus the values 4, 8, 16 or 32. E.g. to enable

‘*/

‘//1 = 40-bit encryption

‘//2 = 128-bit encryption

PDF.Encryption = 2

‘PDF.OwnerPassword = “owner”

PDF.UserPassword = “password”

‘MsgBox “pwd set”

‘PDF.Permissions = (-64 + 32)

‘//Apply changes

PDF.SetDefaultConfig

Set PDF = Nothing

‘MsgBox “done”

App-V Application refresh failure with same name

Situation: we had recently repackaged a new verson of an applicaiton and though the ucn path had changed, the APP-V name was identical.

Error: The Application Virtualization Client cannot use the OSD file specified because the GUID attribute for the CODEBASE element changed (rc 0C403B04-00001004).

Solution: under sftcmc.msc the properties of the app showed the OSD file pointing to the previous version of the published apps directory

On the server I opened the cmd prompt as ‘run as administrator’ and did the following

list all apps: sftmime query obj:app /short

Remove the application: sftmime.exe remove app:”applicationName” /complete

References:

http://support.microsoft.com/kb/931188

Batch File – Sound Alert on Folder Exist

:TestAgain CLS

IF NOT EXIST c:FOLDERALERT_* GOTO NOALERT

“C:windowssndrec32.exe” /play /Close  “C:WINDOWSMEDIAWindows Ringin.wav”

REm Start /MIN “C:Program FilesWindows Media Playerwmplayer.exe”  “C:WINDOWSMEDIAWindows Ringin.wav” REM “%SystemRoot%system32SoundRecorder.exe” /CLOSE /PLAY “C:WINDOWSMEDIAWindows Ringin.wav”

PING 127.0.0.1 -n 5 -w 2000 >NUL Rem Taskkill /IM “WMplayer.exe” /F

PING 127.0.0.1 -n 5 -w 2000 >NUL GOTO TestAgain

:NOALERT

PING 127.0.0.1 -n 5 -w 4000 >NUL

GOTO TestAgain

Automation of Printer settings for PVS images

Scenario: A password protected printer, where the password changes every month. We had to manually enter the new password when our PVS images were rebooted, as we didnt want to update the PVS image with just a password change (we hadnt introduced DFS-R for the PVS image management so it was manual and time consuming)

Solution:

EXPORT the settings to a file for the specific printer – rundll32 printui.dll,PrintUIEntry /Ss /n “MYLAMEPRINTER” /a “file.dat” u

IMPORT the settings to any server that needed it – rundll32 printui.dll,PrintUIEntry /Sr /n “MYLAMEPRINTER” /a “file.dat” u

Add this as a startup script GPO

References:

http://support.microsoft.com/kb/189105

http://zacky.cleverits.com/IT/printer.htm

http://www.robvanderwoude.com/2kprintcontrol.php

http://www.unattendit.com/2009/10/17/unattended-installation-of-network-printers-using-printui-dll-for-all-users/

XenApp 6.5 PVS Generalise Script 2012

Copy of script used to further ‘generalize’ our XenApp servers before cloning via PVS

__ BEGIN SCRIPT ___

REM clear event logs

wevtutil cl System

wevtutil cl Security

wevtutil cl Application

wevtutil cl Setup

wevtutil cl “Forwarded Events”

 

REM Stop Edgesight and Delete database

net stop RsCorSvc

net stop FirebirdServerCSMInstance

del “C:ProgramDataCitrixSystem MonitoringDataRSDATR.FDB” /q

del “D:ProgramDataCitrixSystem MonitoringDataRSDATR.FDB” /q

 

REM stop Appsense Services and delete JUST the machine ID

net stop “AppSense Application Manager Agent”

net stop “AppSense Client Communications Agent”

net stop “AppSense EmCoreService”

net stop “AppSense Watchdog Service”

reg delete “HKEY_LOCAL_MACHINESOFTWAREAppSense TechnologiesCommunications Agent” /v “Group ID”

reg delete “HKEY_LOCAL_MACHINESOFTWAREAppSense TechnologiesCommunications Agent” /v “Machine ID”

 

REM Change EnableSecuritySignature value to 0 for drive mappings to modified down level clients (Win 2000) – this setting didnt work in just GPO.

reg delete “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesLanmanWorkstationParameters” /v “EnableSecuritySignature” /f

reg add “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesLanmanWorkstationParameters” /v “EnableSecuritySignature” /t REG_DWORD /d 0 /f

App-V Registry Keys to force offline operation

Setting the following keys will allow app-v packages to be installed from the packages MSI (if the option is ticked for said package when sequencing) this should then allow for the packages to be run in offline / disconnect mode indefinitely.

MSI Install Example:

msiexec.exe /i “app-v msi package” sftpath=”path to matching package sft file”

Registry keys (taken from vbscript attached below)

HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientNetwork”,”LimitDisconnectedOperation”,0
HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientNetwork”,”Online”,0
HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientConfiguration”,”AutoLoadTriggers”,0
HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientConfiguration”,”AutoLoadTarget”,0
HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientConfiguration”,”RequireAuthorizationIfCached”,0
HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientConfiguration”,”AllowIndependentFileStreaming”,0
HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientPermissions”,”ToggleOfflineMode”,0

App-V Change Tray Visibility (taken from vbscript attached below)

HKEY_LOCAL_MACHINE, “SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientCustomSettings”
HKEY_LOCAL_MACHINE,”SOFTWAREWow6432NodeMicrosoftSoftGrid4.5ClientCustomSettings”,”TrayVisibility”,2
objReg.GetStringValue

Citrix Keys to prevent citrix thin wire session detection from ‘logging off’ the published App-V application (taken from vbscript attached below)

HKEY_LOCAL_MACHINE,”SYSTEMCurrentControlSetControlCitrixwfshellTWI”,”LogoffCheckSysModules”, strValue
objReg.SetStringValue HKEY_LOCAL_MACHINE,”SYSTEMCurrentControlSetControlCitrixwfshellTWI”,”LogoffCheckSysModules”, strValue & “,sftdcc.exe”

VBScript File (rename from .doc to .vbs)

appv_disconnected

Filter Citrix applications by description for PNAGENT and Citrix Web Interface 5.3 and 5.4

OK – there is heaps of stuff out there but i just wanted to attach a damn file in the right WORKING format for NEXT time I have to waste an hour trying to get this working. I cannot take any credit for any of this – im just a cut and paste monkey – see below for references and credits.

REMEMBER DO NOT LEAVE ANY COPIES OR RENAMED VERSIONS OF THE SAME FILE IN THE APP DIRECTORY – THIS WILL BREAK PNAGENT

PNAGENT SERVICES 5.3 SINGLE FILTER
Default Location: c:inetpubwwwrootCitrixPNAgentapp_codePagesJavacomcitrixwipna
Filter File: FILTERED_single_Enumeration.jav

This file will filter all apps that have a descripiton that STARTs with #  – be SURE to rename to ‘enumeration.java’

PNAGENT SERVICES 5.4 DUAL FILTER
Default Location: c:inetpubwwwrootCitrixPNAgentapp_codePagesJavacomcitrixwipna
Filter File: FILTERED_dual_Enumeration.java
This file will filter all apps that have a description that STARTs with # or START with * – be SURE to rename to ‘enumeration.

No need to run IISRESET.

References:

http://blogs.citrix.com/2011/07/06/hiding-applications-on-web-interface-xenapp-and-services-sites/

http://www.raido.be/frontend/files/whitepapers/31_s6vaxlpf.pdf

 

Add automatic launching of executable from IE in protected mode

When opening Internet explorer on XenApp 6.5 – we would get a prompt that a program is trying to open outside of Internet explorer’s protected mode.

Error:

This program will open outside of Protected mode. Internet Explorer’s Protected mode helps protect your computer. If you do not trust this website, do not open this program.

Name: Citrix FTA, URL VDA Redirector

Publisher: Citrix Systems, INC

Resolution:

http://support.citrix.com/article/CTX133274 – Use the citrix Article to disable the URL interceptor entirely, or

[HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerLow RightsElevationPolicy{5196FFCF-C942-4E9B-AEDE-88DBF2E1DDE8}]
“AppPath”=”C:\Program Files (x86)\Citrix\system32”
“AppName”=”VDARedirector.exe”
“Policy”=dword:00000003

Other applications can be added in here like Excel, Power point, word etc to enable the programs to open without prompting natively from IE’s protected mode.

Appsense EM xml Snippet (txt renamed to doc due to wordpress security)

CTX_FTA_EM_Snippet_8.2.216.0

UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE-UPDATE

Additional executables to be allowed for the end users redirector.exe

[HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerLow RightsElevationPolicy{5C1359F1-E04E-4231-9E7E-955DE92A17E1}]
“AppName”=”redirector.exe”
“AppPath”=”C:\Program Files (x86)\Citrix\ICA Client”
“Policy”=dword:00000003