Tag: Tweet

Thomas Maurer Travel

My 2018 – I call it a year!

This is my last blog post of 2018. I just came back from my last flight in 2018 and I am happy to spend a relaxing New Year’s Eve with my close friends and girlfriend. 2018 was a great, intense and challenging year, with a lot of learnings and a lot of good things happening. I just want to thank all my friends, colleagues, supporters, blog readers and followers for everything. People who read, like, comment and share my blogs and tweets, people who listen to my talks and videos, people who I have conversations with, you all give me the motivation to keep on doing this.

I also want to use the chance to thank my sponsors, your support and partnership helps me a lot.

For years now, I had the chance to travel around the world, engage with the community, learn, make new friends and even find love. For that, I am happy and thankful and that the hard work pays off.

There were a lot of highlights, like traveling, speaking, new gadgets, server releases, hybrid cloud platforms, the Microsoft MVP Award and devices, this year and it is hard to name them all, so I just let them be 😁

I am looking forward to 2019 and a new year full of new challenges and experiences. 2019 will have some big changes coming up, so stay tuned.

With that I want to thank you all and wish you all the best and a good start into 2019!

Happy New Year! 🥂🎉🥳

– Thomas



Powershell: Send Tweet

Powershell Header

For some reason your Powershell script should send a Tweet. With this function Powershell will send a message to Twitter.

function Send-Tweet($Message)
{
#Twitter Login
$Twitter_UserName = "yourname"
$Twitter_Password = "yourpassword"
$Twitter_URL = "https://twitter.com/statuses/update.xml?status="

$Twitter_Request = [System.Net.WebRequest]::Create($Twitter_URL + $Message)
$Twitter_Request.credentials= New-Object System.Net.NetworkCredential($Twitter_UserName,$Twitter_Password)
$Twitter_Request.method= "POST"
$Twitter_Request.contentType = "application/x-www-form-urlencoded"
$Twitter_Request.GetResponse().statusCode # return the status code of the request
}

You can now call this function and add a message

Send-Tweet "This is my first Tweet from Powershell"

Twitter

If you need a interactive script you can simply use this (seen by Bhargav’s IT Playground)

function Send-Tweet($Message,$UserName){
if($Message-eq$null){$Message=Read-Host"Enter your tweet"}
if($Username-eq$null){$Username=read-host"Enter your twitter username"}
if($Password-eq$null)
{
$Password=read-host-assecurestring"Enter your twitter password"
$marshal=[Runtime.InteropServices.Marshal]
$Password=$marshal::PtrToStringAuto($marshal::SecureStringToBSTR($Password))
}
$url="https://twitter.com/statuses/update.xml?status=$Message"
$request=[System.Net.WebRequest]::Create($url)
$request.credentials=New-Object System.Net.NetworkCredential($UserName,$Password)
$request.method="POST"
$request.contentType ="application/x-www-form-urlencoded"
$request.GetResponse().statusCode # return the status code of the request}