Category Archives: miscellaneous

Reset the print protection of a pdf document

Hi,

last week a customer had the problem that he lost a Word Document which he wants to print. Only a pdf of the document was available but in this file the print protection flag was set.

I used Ghostscript to reset the print protection.

Install Ghostscript and use this command line to write a new version of the pdf file which is printable


gswin.exe -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=d:\temp\OUTPUT.pdf -c .setpdfwrite -f D:\Temp\input.pdf

Michael

Advertisment to support michlstechblog.info

Script to get a list of computers connected to a Avocent KVM switch

Hello,

in his office, a customer have a few Avocent KVM switches to control some client computers in a remote room. He ask me about the possibility to get a list of all computers connected to these boxes, because he do not want to maintain any list by hand.

I research the documention but there is no (scripting) interface from which I could get such a list. SSH is only for connecting serial consoles, SNMP offers no OIDs for such a case.

Because of the costs, DSView isn’t a option. The only way seems to be to extracting the list by reading the Webfrontend HTML output. Let us do this 🙂

I wrote a script in powershell, at least version 2 is needed to handle selfsigned SSL certificates, which do the following:

  • Login to the Webfronted with https and SSL encryption by System.Net.HTTPWebRequest class to get the authentification cookie
  • Get the Device HTML  page by .NET class System.Net.Webclient and using Authentification cookie
  • Save HTML do a temporary file
  • Open the file with Internet Explorer
  • Get the URL to start a KVM session, computername and portnumber by  DOM

Script details

Define the User, Password, protocol and the devices:

# KVM User
[string]$sUser="Admin"
# KVM Password
[string]$sPassword="YourPassword"
# Protocol
[string]$sProtocol="https"
# Your Devices
[String[]]$aAvocentDevices=@("Console1.domain.local","Console2.domain.local")

Built HTTP POST text and disable SSL certificate warnings
Continue reading Script to get a list of computers connected to a Avocent KVM switch

Hello

Hi everybody , I’m Michael,

this is my first blog. In the future I want to share a lot of my knowledge about my hobbies with you.  This includes windows, linux, vmware & openvpn script samples and snipets, solutions for errors, which I resolve for my customers and some other projects such an lowcost EIBD Gateway for KNX/EIB homeautomation system based on an AVM Fritz!box 7112 and a TPUART Interface.

Ok that was it now. The following post is a collection of the windows tools I use for troubleshooting and daily buisness.

See you Michael