Monthly Archives: April 2014

Subtitles are a serious business

I enjoy movies a lot. Most of them are in English and nothing beats watching them with an original soundtrack and voice acting. Some house inhabitants disagree and feel more comfortable with subtitles.

Previously I’ve used a utility to grab the needed subs and it used to work perfectly, right before the moment the developer decided to monetize and inserted credits, waiting queues and popping up viagra adds.
That’s how I began searching for software app that would fit my needs – right click a file, SubIt and play.
Surprisingly, the list of appropriate apps is not that large and I decided against using some un-needed feature stacked clumsy “have-it-all” wannabes.
Now to the point. OpenSubtitles has a developers section that explains how to interact with their RPC server. You search subtitles using file hash (can’t go wrong with this!). For a moment I considered writing my own utility, but due to “everything can be found on the internet” went with a free one (VrokSub) from the general list of apps using the API.
Ended up configuring Windows Shell extensions. Everything I wanted – right click and it plays with subtitles.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\VLC.avi\shell\Subtitle Now\command]
@=”cmd /c \”\”C:\\Users\\*******\\Folder1\\Folder2\\Vroksub\\VrokSub.exe\” \”%1\” en,ru /newonly & \”C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\” –started-from-file –no-playlist-enqueue \”%1\”\””
[HKEY_CLASSES_ROOT\VLC.mkv\shell\Subtitle Now\command]
@=”cmd /c \”\”C:\\Users\\*******\\Folder1\\Folder2\\Vroksub\\VrokSub.exe\” \”%1\” en,ru /newonly & \”C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\” –started-from-file –no-playlist-enqueue \”%1\”\””
[HKEY_CLASSES_ROOT\VLC.mp4\shell\Subtitle Now\command]
@=”cmd /c \”\”C:\\Users\\*******\\Folder1\\Folder2\\Vroksub\\VrokSub.exe\” \”%1\” en,ru /newonly & \”C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\” –started-from-file –no-playlist-enqueue \”%1\”\””
With the occasional “Service Unavailable” it’s still more bearable than surfing the subtitle websites.
And it even has a neat feature to completely download subs for all files in a folder:
“vroksub.exe “c:\my videos” gr,en
This will first try to locate a greek subtitle for every movie in c:\my videos (including subfolders) and if it doesn’t find one it will try to find one in english. You can use more language codes if you’d like.”
 A kudos to the utility author!

Powershell backup from FTP

While most of the posts on the internet are describing how to backup a file to FTP, I’ve actually spent some time doing the opposite.

With large amounts of cloud storage providers (OneDrive?) there’s really not much point to backup files to your website (FTP) hosting, at least for personal use. And as for enterprises – who says you can’t encrypt your data before moving it to the cloud? 7-zip comes to mind as the encryption + archiving tool of choice for today.
I needed a way to make sure that I don’t lose my blog files and that I won’t have to back them up manually. I didn’t want to install any 3rd party client software on my PC. “PowerShell FTP Client Module” came to the rescue.

The one thing I really enjoyed was the Start-Process cmdlet functionality to return the exit code of the application. Awesome and easy.

After that it’s just a matter of setting the .ps1 script up with Windows Task Scheduler and it’s good to go.


#gregbin.com
#No guarantees given, use at your own risk.
#Based on PowerShell FTP Client Module http://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb
#Requires 7-zip and PowerShell FTP Client Module
#Description: Pulls a folder and it's contents from FTP server

#Transfers the entire FTP directory to the local machine
#Archives the copy
#Validates the integrity of the archive
#Remove the copied folder, leaving a nicely compressed archive to save storage


#Variables
$User = "****************"
$PWord = ConvertTo-SecureString –String "************" –AsPlainText -Force
$Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord
$FTPSessionName = "Gregbin"
$FTPServerName = "ftp://ftp.domain.com"
$BackUpLocation = "C:\Skydrive\Backup\$DateTime"

$DateTime = Get-Date -format "dd_MMM_yyyy_HHmm"
$BackUpArchive = "$BackUpLocation.7z"
new-item -type directory -path $BackUpLocation -ea silentlycontinue | Out-Null

Import-Module PSFTP 

Set-FTPConnection -Credentials $Credential -Server $FTPServerName -Session $FTPSessionName -UsePassive

$Session = Get-FTPConnection -Session $FTPSessionName

#Example folder path - "/wwwroot/images/important"
Get-FTPChildItem -path /FTP_folder_path_here -Recurse -Session $Session | Get-FTPItem -localpath $BackUpLocation -RecreateFolders -Verbose -Session $Session

."C:\Program Files\7-Zip\7z.exe" a $BackUpArchive $BackUpLocation

if ((Start-Process -FilePath "C:\Program Files\7-Zip\7z.exe" -ArgumentList "t $BackUpArchive" -Wait -Passthru -NoNewWindow).ExitCode -eq "0") {Remove-Item $BackUpLocation -Recurse} else {Write-Host "it haz failedz"}
What could have been done better if given the time, ambition and more than ad-hoc use:
1) Add asynchronous operations: enumeration of each file one-by-one and downloading it one-by-one after that doesn’t add to the performance of the solution
2) Encrypt the storage archive with a password if paranoia is on the rise
3) Work on error handling
4) Sign the .ps1 file with a certificate
5) Create a prerequisite checker for 7-zip application, network connectivity, administrative elevation
6) Do not rely on on external pshell modules and use WebRequestMethods.Ftp Class
7) More SSL – “Unless the EnableSsl property is true, all data and commands, including your user name and password information, are sent to the server in clear text. Anyone monitoring network traffic can view your credentials and use them to connect to the server. If you are connecting to an FTP server that requires credentials and supports Secure Sockets Layer (SSL), you should set EnableSsl to true.”

Set-FTPConnection -EnableSsl
8) Archive on server side first, transfer later

App-V 5 Revisited

Had a wonderful time @ workshop in Stockholm, Sweden this week. Transition from ThinApp to App-V 5.0 for a customer.

General playing around.

It’s been one and a half year since I’ve visited the subject of App-V 5.0. Since then MS released the latest and greatest App-V 5.0 SP2. What I find hilarious is that some of the release highlights are actually features that were suppose to work at the time of the core product release, such as:

  • App-V 5.0 SP2 now supports folder redirection for local user appdata directory (oh, really?)
    App-V 5.0 SP2 supports local %AppData% folder redirection. For more information see the Deploy the Client section of Deploying the App-V 5.0 Sequencer and Client.
  • App-V 5.0 Package Upgrade Improvements
    In App-V 5.0 SP2, you will no longer be prompted to close a running virtual application when a newer version is available. When an application is running, related publish operations will only run at a later time when the virtual environment is no longer in use. Un-publish operations for an application in use will also pend and will be processed at a later time.

Reading into the above lines and letting the knowledge sink into you only elevates degree of confusion. 😉

In past experience I remember that App-V 4.x wasn’t usable without hotfixes (apps breaking after updates, technology not allowing to virtualize several apps and the like). Same applies to this release. “Hotfix Package 2 for Microsoft Application Virtualization 5.0 Service SP2” don’t go home without it. @ the workshop when sales/tech guy from MS was confronted with the question he confirmed that the core product is not really “usable” without hotfixes. And by usable I mean – the whole list of issues described in KB from 1 to 5. Looks a lot like the list of issues version 4.x had. Update: And followed-up by HF3.

Generic Requirements and solution draft.

Requirements:

1) Improving app lifecycle

2) Streamline and simplify updates

3) Improve quality

4) Unify SCCM, Citrix XenApp, XenDesktop

Generic Solution sketch.

1) SCCM integration with App-V 5.0, apps to desktops/laptops are distributed through SCCM console, download and execute, not stream from distribution point, since the % of mobile workforce is high.

2) App-V Management Server for Citrix XenApp, XenDesktop, apps are pre-cached on RDS servers OR shared content store is used.

3) Same apps are used across the enterprise. Publishing methods differ.

4) For seamless update experience a new package will be created from ground zero each time to generate a unique ID for the package. It has been established that with version update seamless experience is not possible. A simple example of that is an app with shell extensions that hooks into explorer.exe – it will never update before the users relogs, which is not a scenario enterprises want to see. In RDS environment this issue escalates.

The downside of this approach is per-application user data that will not be migrated between version ID changes. Potentially “Microsoft User Experience Virtualization (UE-V)” should be considered for this if the existing User Profile Management solution doesn’t prove flexible (scriptable) enough.

Furthermore, it has been established that rollback of an application version that is globally published is not possible without PC restart. This undermines the appeal of using the app version model. I am truly surprised by this, but in my experience the same issue was present in 4.x.

Note: Apparently the “branch out” or “save as new package” feature has been cut out from app-v 5.0. This puts an additional heavy burden on the lifecycle of the apps, as instead of just installing a patch on top of the existing configuration – the whole configuration is re-made from ground zero each time – with this approach there is a risk of malfunction or bits and pieces of functionality falling off after, for example, a patch install.

Generic Technical solution sketch.

1) “System Center 2012 Configuration Manager SP1 and System Center 2012 R2 Configuration Manager.” in place as a prerequisite.

2) Implementation of App-V 5.0 Management Server, Reporting Server, Publishing Server for Citrix XenApp, XenDesktop. One server box, 3 IIS websites, no HA in scope.

3) Two databases for App-V 5.0 – Management Database, Reporting Database.

4) GPO for Citrix XenApp, XenDesktop App-V Client Configuration.

5) Network share (SAN) for application files.

6) .ps1 script for pre-caching apps on RDS servers if Shared Content Store is not used.

7) Troubleshooting scripts for technicians – Repair-AppvClientPackage and Sync-AppvPublishingServer. Note: Self-service for users not possible if App-V 5 app is distributed to machine accounts (globally cached).

Notes & References.

App-V 5.0 still looks like a big scripting playground/challenge. For example – there are no special APIs SCCM uses for distributing app-v apps, it’s plain powershell.exe and scripts. There is no UI in the client application, well, there is, but it comes as a separate installation.

I’ve been really surprised by the level of detail for windows event logs from app-v systems (client, server, etc). Detailed and even with auditing for user access built in. SCOM people will rejoice.

It’s very much like XenApp 6.5 (amazing product) vs XenDesktop 7 (not so much). At this point there is no going back to 4.x and you either have to accept or move to another vendor (ThinApp comes to mind).

The Microsoft App-V Team Blog

Operations for App-V 5.0

App-V 5.0 About Client Configuration Settings

App-V 5.0 and Citrix Integration Overview

Planning for App-V Integration with Configuration Manager

http://blogs.technet.com/b/gladiatormsft/archive/2013/11/13/app-v-on-operational-troubleshooting-of-the-v5-client.aspx