Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Send SMS through mobile phone connected to PC from PowerShell

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-17-2007   #1 (permalink)
PaoloS
Guest


 

Send SMS through mobile phone connected to PC from PowerShell

Hi,
i have one problem. I don't know, how to send a SMS with connected mobile
phone to serial port. I know related AT commands how to do that from
HyperTerm (AT+CMGF=1 and AT+CMGS="PHONE_NUMBER"), but i don't know how to
implement it into PowerShell script. I tried something, but without results...

$port= new-Object System.IO.Ports.SerialPort COM9,19200,None,8,one
$port.Open()
$port.Write("AT+CMGF=1")
Start-Sleep -seconds 3
$port.Write("AT+CMGS=PHONE_NUMBER")
Start-Sleep -seconds 3
$port.Write("Hello, This is my test message")
Start-Sleep -seconds 5
$port.Close()

Thanks for reply.

PaoloS

My System SpecsSystem Spec
Old 11-17-2007   #2 (permalink)
Oisin Grehan
Guest


 

Re: Send SMS through mobile phone connected to PC from PowerShell

On Nov 17, 3:00 am, PaoloS <Pao...@xxxxxx> wrote:
Quote:

> Hi,
> i have one problem. I don't know, how to send a SMS with connected mobile
> phone to serial port. I know related AT commands how to do that from
> HyperTerm (AT+CMGF=1 and AT+CMGS="PHONE_NUMBER"), but i don't know how to
> implement it into PowerShell script. I tried something, but without results...
>
> $port= new-Object System.IO.Ports.SerialPort COM9,19200,None,8,one
> $port.Open()
> $port.Write("AT+CMGF=1")
> Start-Sleep -seconds 3
> $port.Write("AT+CMGS=PHONE_NUMBER")
> Start-Sleep -seconds 3
> $port.Write("Hello, This is my test message")
> Start-Sleep -seconds 5
> $port.Close()
>
> Thanks for reply.
>
> PaoloS
First off, It looks like you're forgetting to send CRLF with each
command; e.g. try:
Quote:

> $port.Write("AT+CMGF=1`r`n")
where `r = CR, `n = LF; If this still doesn't work verify some simple
hayes commands first, e.g. ati0 or ati1 , for product code and
firmware checksum respectively. And finally, even though this is most
likely not the problem, try a lower speed - even 1200bps would suffice
for comms of this nature.

If you want to use events instead of sleeps to read data when it's
waiting, check into my PowerShell Eventing project up on www.codeplex.com/pseventing
; I believe someone is doing something similar with reading a UPS
status via a serial port.

Hope this helps,

- Oisin / x0n
My System SpecsSystem Spec
Old 11-18-2007   #3 (permalink)
PaoloS
Guest


 

Re: Send SMS through mobile phone connected to PC from PowerShell

Hi Oisin,
thanks for reply, but still not works...

clear
$port= new-Object System.IO.Ports.SerialPort COM9,1200,None,8,one
$port.Open()
$port.Write("AT+CMGF=1`r`n")
Start-Sleep -seconds 3
$port.Write("AT+CMGS=+1234567890`r`n")
Start-Sleep -seconds 3
$port.Write("Hello, This is my test message`r`n")
Start-Sleep -seconds 5
$port.Close()

I tried ati0 and ati1, from terminal it works, but i don't know how to read
output from command to console.
Do you have any other idea, where the problem should be?

I found on net syntax for "AT+CMGS" command, phone number must be in
"quotes", but i don't know how to write it into the script. Maybe there is
the problem, why id doesn't work.

Help please. PaoloS.
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
mobile phone 8125 GIORGIO Vista hardware & devices 0 06-30-2008 04:25 PM
mobile phone photos to computer maz Vista music pictures video 1 03-06-2008 02:29 PM
RTM & Windows Mobile 5 Phone Dan Bachrach Vista General 13 12-04-2006 11:59 PM
could powershell connect to mobile phone and send out sms? JamesPang PowerShell 2 11-18-2006 02:23 AM
Transfering pictures from Mobile phone Nigel S Vista music pictures video 5 11-06-2006 01:49 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51