čtvrtek 25. dubna 2019

When azure runbook cannot connect to Exchange server through hybrid worker

This is typical SAAS (read S*it as a service). Imagine, you have simple powershell runbook script which is trying to connect to Exchange server from hybrid worker:

$Credentials = Get-AutomationPSCredential -Name 'an_onprem_acount'
$exchOnPremURL = "https://exchangeserver.local/PowerShell/"
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $exchOnPremURL `
-Credential $Credentials -Authentication Basic -AllowRedirection
Import-PSSession -Session $Session -DisableNameChecking:$true -AllowClobber:$true

You can experience tons of different results except one you would expect.... working runbook :) Depends on your settings for hybrid worker, e.g. which account you are using to run the worker you can most probably see, that your runbook is constantly Queued or it is keep restarting itself until it is suspended.

Using google you can find few "solutions" and crazy workarounds like this, however, the solution is easy. You just need to send output of Import-PSSession command to/dev/null ... sorry, Out-Null:

$Credentials = Get-AutomationPSCredential -Name 'an_onprem_acount'
$exchOnPremURL = "https://exchangeserver.local/PowerShell/"
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $exchOnPremURL `
-Credential $Credentials -Authentication Basic -AllowRedirection
Import-PSSession -Session $Session -DisableNameChecking:$true -AllowClobber:$true | Out-Null

strange... right? but no one who works with MS products is not surprised....

Thank you to Bogdan G. S. and Lubomir H.

úterý 1. srpna 2017

Exchange 2016 installation - [ERROR] Installing product E:\exchangeserver.msi failed. Fatal error during installation. Error code is 1603.

If you reached this page, you most probably know, that Exchange is piece of crap. Now, you cannot complete installation. Also, you are not able uninstall this s**t, becuse installation is not completed. Simply Microsoft fun.

You also most probably found following useless links:
http://msexchangeguru.com/2017/02/09/e2016-error1603-unresolved/
https://support.microsoft.com/en-us/help/834484/you-receive-an-error-1603-a-fatal-error-occurred-during-installation-e

Ok, so there is what helped to me:

Problem

Exchange installer disables services in one of the first steps and it tries to start them. Stupid, right? You can confirm it by checking startup type of exchange services once the installer fails. Id they are disabled, following can help.

Solution

1. Prepare command to set all the MS Exchange services to automatic startup type. Include also FMS, HostControllerService, winmgmt, remoteregistry, w3svc and iisadmin services. An example:

Get-Service -name MSExchangeDelivery, MSExchangeRepl,MSExchangeRPC,MSExchangeFastSearch, MSExchangeThrottling, wsbexchange,MSExchangeSubmission, MSExchangeMailboxReplication, MSExchangeMailboxAssistants, MSExchangeIMAP4BE, MSExchangeImap4, MSExchangeIS, MSExchangeDagMgmt, MSExchangeDiagnostics, MSExchangeFrontEndTransport, MSExchangeADTopology, MSExchangeAntispamUpdate, MSExchangeUM, MSExchangeEdgeSync, MSExchangeHM, MSExchangeHMRecovery, MSExchangeServiceHost, MSExchangeTransport, MSExchangeTransportLogSearch, FMS, HostControllerService, winmgmt, remoteregistry, w3svc, iisadmin | set-service -startuptype automatic

2. Start installer again. During step 2, the services should be already disabled again (if you enabled them). It is exact time to fire your prepared command. 

3. Pray


středa 23. března 2016

GPRS s Arduino a problémy s O2 CZ

Tak jsem dospěl k bastlení GSM modulu k Arduinu (konkrétně SIM800L). Vše probíhalo krásně až na problémy se SIM kartou O2 CZ s tarifem Machine.

Píšu tuhle notičku jen pro ty, co se dostanou do stejného začarovaného kruhu, kdy všechno funguje, jen veškeré GPRS requesty skončí timoutem (Týká se to i zjišťování GSM lokace).

AT+HTTPACTION=0

vrátí sice OK, ale výsledkem je buď +HTTPACTION 601 Network error a nebo timeout.

Pro GSM lokalizaci:

AT+CIPGSMLOC=1,1

Pak error 603 nebo 601 dle nálady.

Řešení:


  1. O2 CZ nemá jen jeden APN, má jich několik a pro machine tarify je údajně určen APN Telemetry1 (nicméně, ten také nefunguje, viz řešení 2)
  2. Pokud ani Telemetry1 nefunguje, pak se musíte obrátit na podporu O2 a ti milostivě zařídí, že vaše sim může komunikovat s APN "internet", kde už vše běhá jak má.

Ostatní APN:  Internet, Oneport, Cma, Telemetry, Telemetry 1

Ukázkové komunikace:

Špatné APN:
  • ---> AT+CIPSHUT
  • <--- SHUT OK
  • ---> AT+CGATT=1
  • <--- OK
  • ---> AT+SAPBR=3,1,"CONTYPE","GPRS"
  • <--- OK
  • ---> AT+SAPBR=3,1,"APN","Cokoliv"
  • <--- OK
  • ---> AT+CSTT="Cokoliv"
  • <--- OK
  • ---> AT+SAPBR=1,1
  • <--- OK
  • ---> AT+CIICR
  • <--- OK
  • ---> AT+CIPGSMLOC=1,1
  • <--- +CIPGSMLOC: 601
Dobré, ale nefunkční APN:
  • ...-začátek je stejný ....
  • ---> AT+SAPBR=3,1,"APN","Telemetry1"
  • <--- OK
  • ---> AT+CSTT="Telemetry1"
  • <--- OK
  • ---> AT+SAPBR=1,1
  • <--- OK
  • ---> AT+CIICR
  • <--- OK
  • ---> AT+CIPGSMLOC=1,1
  • <--- Time out
Funkční APN:
  • ...-začátek je stejný ....
  • ---> AT+SAPBR=3,1,"APN","internet"
  • <--- OK
  • ---> AT+CSTT="internet"
  • <--- OK
  • ---> AT+SAPBR=1,1
  • <--- OK
  • ---> AT+CIICR
  • <--- OK
  • ---> AT+CIPGSMLOC=1,1
  • <--- +CIPGSMLOC: 0,14.4XXXX,50.0XXXXX,2016/03/23,13:14:48

úterý 26. ledna 2016

Why is serial output of my Arduino garbled?

Ugly Arduino output

I spent few hours to solve garbled serial output produced by my Arduino (Uno, Nano, doesn't matter). All of a sudden the serial output looked ugly:


I tried to revert last lines I added to the code. Sometimes it helped, sometimes little bit and there was no one single row which was causing it... However, the solution was very easy. As I was adding code to just testing sketch I didn't care about best programming practices and I wasted whole my RAM memory .... 
Problem is, that pretty all serial communications libraries are using dynamic buffers, which could be pretty demanding. In my case, when I compiled and started the code, just 57 bytes left in the memory. When the communication channel was busy the Arduino simply ran out of memory.

So what I learned? 

Every time you can use F() to store string in program memory, even for just test projects. Other memory saving techniques can be found on google.. :)

use following function to check amount of available memory:

int freeRam() {
  extern int __heap_start,*__brkval;
  int v;
  return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int) __brkval);
}

úterý 8. září 2015

IT Troubles - How to map NFS drive on Windows server

We spent plenty of time to properly mount NFS share on our Windows based servers. We are using NFS for IBM FileViewer and Conversion server for IBM Connections and also for IBM Domino servers. And finally we did it! Anyway, I guess, that following guide is usefull for everyone :)

Preparation:

Procedure:
Create script to map the drives. e.g. mount.ps1
For each drive use following command:
New-PSDrive -Name "X" -PSProvider FileSystem - Root "\\nfs_server_host_or_ip\nfs_path" -Persist

where:
X is mapped drive letter
nfs_server_host_or_ip ... is clear, right?
nfs_path .. is also clear

example:
New-PSDrive -name "G" -PSProvider FileSystem -Root "\\192.168.1.1\nfsvolume" -Persist

Create new scheduled task:
  • For running use SYSTEM account (on General tab, click on "Change User and Group" then click on "Advanced", "Find Now" and select user "SYSTEM" ... Ok, Ok, Ok)


  • As a trigger set "At system startup"
  • Under Action tab run powershell and as a parameter "-file mount.ps1"

And restart Windows server :)

Remarks:
  • All services which are accessing the NFS drive must be running under local system account
  • If you try to execute New-PSDrive manually under an user account, the services above won't be able to access the drive (you must run powershell under system account - download PSTools from http://www.sysinternals.com and start powershell using command: PSExec.exe /SID PowerShell.exe - then it will work)
  • To remove the drives use Remove-PSDrive X command
  • The icons for the drives will have red cross over them... anyway it works! :)




pátek 14. srpna 2015

WebSphere troubles - Could not authenticate user to messaging bus

Problem description:

You are most probably trying to configure kerberos for your cell.
Your application on a server are not started. In SystemOut.log you can find following error messages:

CWSII0205W: The bus ConnectionsBus could not authenticate the user wasadmin.
J2CA0138E: The Message Endpoint activation failed for ActivationSpec jms/connections/search/as (com.ibm.ws.sib.api.jmsra.impl.JmsJcaActivationSpecImpl) and MDB application Search#dboard.search.ejb.jar#IndexTopicMDB due to the following exception: javax.resource.ResourceException:
CWSIV0954E: The authentication exception com.ibm.wsspi.sib.core.exception.SIAuthenticationException:
CWSIP0301E: Unable to authenticate user wasadmin when creating a connection to secure messaging engine ConnectionsBus on bus ConnectionsBus. was thrown while attempting to create a connection on factory com.ibm.ws.sib.processor.impl.MessageProcessor

Solution:

Open your ISC and navigate to Security > Global security and ensure, that you have selected "LTPA" option under Authentication section. WebSphere System Console is switching this option itself when it thinks it is good. And it obviously isn't.


středa 15. července 2015

Včelařská váha, díl 5a. Oprava

Menší oprava

Ztráta 4 kilogramů nebyla způsobena rojením včel, jak jsme se zcela mylně domnívali, nýbržto odebráním jedné cihly, která zatěžovala víko úlu.
Graf vývoje očištěný o tuto externalitu pak vypadá takto:

Stále je jasné, že po prvních týdnech flákání včelám došlo, že zima se přece jenom blíží. Co na tom, že o vše přijdou :)