[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Login to searial session with powershell

Posted on 2014-02-04
6
Medium Priority
?
416 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 71

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 71

Accepted Solution

by:
Qlemo earned 2000 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
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
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 71

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

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
Loops Section Overview
Screencast - Getting to Know the Pipeline

825 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