logo

The ConnectWise Control forum has moved to ConnectWise University! This forum has been locked and is in read-only mode. Click here for instructions on how to access the new forum.

Welcome Guest! You can not login or register.

Notification

Icon
Error

Options
Go to last post Go to first unread
softland  
#1 Posted : Monday, October 17, 2016 8:19:11 PM(UTC)
softland


Rank: Newbie

Joined: 10/17/2016(UTC)
Posts: 11
Chile
Location: Santiago

Hello,

We have a powershell script that uses the SC toolkit to transcode/export videos. It has been in use since version 5.1, but it started having problems under version 5.6. Using the original DLLs from the earlier version it seems to work on some videos, but then fails generating parameter errors or unhandled exceptions on others at the transcode step.

When I tried running the script using the 5.6 DLLs it tells me there is no method for [ScreenConnect.WindowsToolkit] 'CreateVideoFileEncoder'.


Where can I find information on the changes to the toolkit objects ?


The original script looks like this:

Add-Type -Path (Get-Item "C:\MNT\ScreenConnect.Core.dll").FullName
Add-Type -Path (Get-Item "C:\MNT\ScreenConnect.Server.dll").FullName


foreach ($captureFile in Get-ChildItem("\\reunion\ScreenConnect\App_Data\Session
\9ca4d27b-8d99-45e1-bf90-ba621d0ca453-f25edea9-8ae3-4e4e-85fa-9934f4ea6c51-2016-
10-12-21-17-28*"))
{
Write-Host $captureFile
Try
{
If ((Test-Path ("C:\mnt\1179398 FUNDAMENTA GESTION SpA PDB1a.AVI")) -or ($captureFile.FullName -like "*.avi")) {
Write-Host ".FNF." -NoNewline
}Else{
Write-Host "Convirtiendo -"$captureFile.FullName.Trim()""
$inputStream = [System.IO.File]::OpenRead($captureFile.FullName)
Write-Host "Instanciando Codificadora"
$encoder = [ScreenConnect.Toolkit]::Instance.CreateVideoFileEncoder()
Write-Host "Conversion en proceso.."
[ScreenConnect.ServerExtensions]::Transcode($inputStream, $encoder, "C:\mnt\1179398 FUNDAMENTA GESTION SpA PDB1a.AVI")
}
}
Catch
{
echo "Error procesando $($captureFile): $($Error[0])"
}
}
Write-Host "PRIMER VIDEO Listo!"

Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")


foreach ($captureFile in Get-ChildItem("\\reunion\ScreenConnect\App_Data\Session
\9ca4d27b-8d99-45e1-bf90-ba621d0ca453-b738155a-5a49-4268-8e18-faa4faa63731-2016-
10-12-20-47-15*"))
{
Write-Host $captureFile
Try
{
If ((Test-Path ("C:\mnt\1179398 FUNDAMENTA GESTION SpA PDB1b.AVI")) -or ($captureFile.FullName -like "*.avi")) {
Write-Host ".FNF." -NoNewline
}Else{
Write-Host "Convirtiendo -"$captureFile.FullName.Trim()""
$inputStream = [System.IO.File]::OpenRead($captureFile.FullName)
Write-Host "Instanciando Codificadora"
$encoder = [ScreenConnect.Toolkit]::Instance.CreateVideoFileEncoder()
Write-Host "Conversion en proceso.."
[ScreenConnect.ServerExtensions]::Transcode($inputStream, $encoder, "C:\mnt\1179398 FUNDAMENTA GESTION SpA PDB1b.AVI")
}
}
Catch
{
echo "Error procesando $($captureFile): $($Error[0])"
}
}
Write-Host "SEGUNDO VIDEO Listo!"


Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Thanks for your help..

Dave

softland  
#2 Posted : Wednesday, October 26, 2016 6:48:55 PM(UTC)
softland


Rank: Newbie

Joined: 10/17/2016(UTC)
Posts: 11
Chile
Location: Santiago

If anyone is interested, the problem seems to be that the VideoEncoder is wrapped in a Singleton in the newer versions.

Changing the line
$encoder = [ScreenConnect.Toolkit]::Instance.CreateVideoFileEncoder()

to

$tlkt = [ScreenConnect.Toolkit]::Instance
$encoder = $tlkt.CreateVideoFileEncoder()

Seems to resolves the instantiation problem for the encoder.

Dave
Users browsing this topic
Similar Topics
Powershell transcoding help (Advanced Customization)
by willjasen 3/1/2017 6:36:18 PM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.