Solved

Login to searial session with powershell

Posted on 2014-02-04
6
378 Views
Last Modified: 2014-02-07
Hi Experts,

I have to configure a UPS through the console port. Is it possible to automate this with Powershell?

I found out how to connect, but can i also login using a powershell script? And if thats possible, can i run some commands in hyperterminal to configure the device?
0
Comment
Question by:SvenIA
  • 3
  • 3
6 Comments
 
LVL 69

Expert Comment

by:Qlemo
ID: 39833221
There are different approaches. You can use scriptable clients like Putty, or the classic SendKeys way well-known from VB Script code. SendKeys simulates keystrokes, and works well if you don't need to respond to prompts in different ways.
0
 
LVL 7

Author Comment

by:SvenIA
ID: 39834904
Ok thanks, but can it be done just by using PowerShell?
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39835771
SendKeys can be used in Powershell. This should give you a start. The COM port settings are stored in UPS.ht. ~ is the same as {ENTER}, a carriage return.
cls
Set-StrictMode -version latest

Add-Type -Assembly Microsoft.VisualBasic
Add-Type -Assembly System.Windows.Forms

$term = start-process "C:\HyperTrm\UPS.ht" -PassThru

[Microsoft.VisualBasic.Interaction]::AppActivate($_.ID)
sleep -m 100
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
sleep -m 500
[System.Windows.Forms.SendKeys]::SendWait("TheUser~")
sleep -m 500
[System.Windows.Forms.SendKeys]::SendWait("ThePassword~")
sleep -m 500
# and so on

Open in new window

0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 7

Author Comment

by:SvenIA
ID: 39841289
Thanks, this does give me a start. However, i got one problem left. I use a portable version of HyperTerminal on Windows 7. I associate the ups.ht file with HyperTerminal. But when i try to open it by doubble clicking it, or by using the script, i get this error. Tried it on different computers....

Error
Can i fix this? What are alternatives for HyperTermal wich can save connection configurations?
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 39841321
You can use hypertrm C:\temp\ups.ht to start it with a configuration.
For repairing the double-click action, open RegEdit, go to
  HKEY_CLASSES_ROOT\htfile\Shell\open\command
and check the entry there. It should display something like
   "C:\Program Files\Windows NT\HYPERTRM.EXE" %1
but with the correct path, of course.
0
 
LVL 7

Author Closing Comment

by:SvenIA
ID: 39841409
I got it working!! Thanks so much for your quick and accurate help!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question