Posts

Posts mit dem Label "powershell" werden angezeigt.

Powershell snippet to send messages to telegram

* Powershell snippet to send messages to telegram: [source,powershell] ------------------------------------------------------------------------------------ # send am message to telegram chat via powershell script # ====================================================== $api    = '20****xw4'    # botToken got with bot creation  $chatId = '8***8'            # got with query on bot chat $msg    = 'Hello from powershell (server)' $restResponse = Invoke-RestMethod -Uri ('https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}' -f $api, $chatId, $msg) -Proxy http://193.**.***.207:8080 $restResponse.ok # True ------------------------------------------------------------------------------------ * create telegram chat to send messages to: ** Create the Bot and get the token - open a chat with BotFather Bot. - write /newbot to BotFather,         - fill all the needed ...

powershell: sending e-mail with attachments (using a pipe)

$PSEmailServer = "mailsrv" Get-ChildItem ("c:\temp") |       ForEach {$_.fullname} |       Send-MailMessage -to "x@regele.org" -from "y@regele.org" -subject "hi" -encoding ([System.Text.Encoding]::UTF8) $PSEMailServer needs to contain the smtp Server ForEach ... $_.fullname is required if files are not in current path

windows powershell: execute select against an oracle instance. (System.Data.OracleClient)

in no way a powershell guy, but powershell script: [Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient") > null  $connection=New-Object DATA.OracleClient.OracleConnection(     " Data Source=eoxi;User Id=eoxrep;Password=*** "     )      $connection.Open()  $reader = (new-Object DATA.OracleClient.OracleCommand(     " select * from eox.eox_log_ereignis_a where rownum < 10 ",     $connection)).ExecuteReader()  while( $Reader.Read()) {     $id   = $reader["log_id"]     $time = $reader["log_log_area"]     write-output "$id $time"  }  $connection.Close() executes as: oracle select GAC    Version        Location ---    -------        -------- True   v2.0.50727     C:\Windows\assembly\GAC_32\System.Data.OracleClient 174063524 ww Data Import: ISIN ...