Gastbeitrag: Mit Powershell die Automatisierung automatisieren

Der heutige Artikel kommt von Joel Wiesmann, einem befreundeten Automic-Experten aus der Schweiz, der vor einem Jahr schon einmal hier im Blog einen Artikel veröffentlicht hat.

Er erzählt uns heute vom ApplicationInterface, von Powershell und seinem neuen E-Learning, in dem Sie lernen, beides zusammen zu benutzen.

Als Automation Engineer arbeite ich Tag ein Tag aus mit JOBS Objekten. Täglich sehe und erstelle ich Lösungen mit AE Script, Windows CMD, Perl, Bash und Powershell. Manchmal sind es einfache Aufgaben, manchmal komplexere. Fakt ist: Scriptsprachen begleiten mich Tag für Tag und meine Kenntnisse dazu machen einen großen Teil meines Wertes in der Arbeitswelt aus.

Daher hat es mich immer geärgert, dass meine täglichen Tätigkeiten mit der Automation Engine – also Objekte erstellen, kopieren, ändern etc. – nicht mittels mir bekannter Scriptsprachen automatisiert werden konnten.

Ahnen Sie schon worauf ich hinaus möchte? Das ApplicationInterface ist die Automic eigene Java Library, mit welcher der «alte» Fatclient implementiert wurde. Wenn Sie am Marketplace nach Automationslösungen für die Automation Engine selbst suchen, finden sie fast ausschließlich in Java implementierte Programme.

Das ist doch kalter Kaffee

Nun habe ich mit Java so meine Probleme.

Ich bin ein Scripter. Ich mag transparente Lösungen, die schnell entwickelt werden und keine Entwicklungsumgebung in der Grösse einer Oracle-Installation benötigen. Selbst wenn ich darüber hinwegsehe und meine Scripts um die Java Programme schreibe – ich habe einen Bruch in der Programmiersprache. Dieser Bruch äußert sich spätestens wenn man neue Anforderungen hat.

Wenn das Programmieren des ApplicationInterfaces in Java das Handwerk des langwierigen Kaffeebrauens ist, dann ist die Implementation in Powershell der Nespresso.

Nehmen wir als Beispiel folgende fiktive Unterhaltung zwischen Joe Jobbauer und einer Mitarbeiterin mit Java KnowHow, Jasmin Java:

Joe Jobbauer: “Ich will alle Objekte exportieren die in der Datei objekte.txt stehen.”

Jasmin Java: “Okay, nutze mytool.jar mit dem Parameter -f objekte.txt”

Joe Jobbauer: “… könnten wir noch einen Datumsfilter einbauen? Nur die Objekte der letzten 12h?”

Jasmin Java: “Okay, habe den -h Parameter hinzugefügt. ”

Joe Jobbauer: “… und wenn’s nur die sein sollen die auf dem Mandanten 2000 nicht drin sind?”

Jasmin Java: “Phew… -C ”

Joe Jobbauer: “Cool. Kann das Programm eigentlich auch importieren?”

Jasmin Java: “…!!!!”

Kennen Sie das? Wünschen Sie sich auch, mit einer Scriptsprache flexible Lösungen selber zu schreiben? Bei PhilippElmer.com gibt es jetz ein E-Learning, in dem Sie lernen, wie Sie mit Windows Powershell das ApplicationInterface API ansprechen können.

E-Learning: Der WorkflowCommander Core

Mit dem E-Learning erhalten Sie:

  • Den WorkflowCommander Core – ein Powershell Modul mit über 20 vorgefertigten Cmdlets für den Zugriff und die Arbeit mit der AE
  • Beschreibung der einzelnen Cmdlets inklusive Beispielen
  • Tipps und Tricks rund um den Einsatz des ApplicationInterface API in der Powershell
  • Workshops mit praktischen und unterhaltsamen Beispielen
  • Sechs Monate Zugriff auf die Schulungsunterlagen inklusive Updates in dem Zeitraum.

Beispiel gefällig? Hier habe ich Ihnen ein paar Zeilen Beispielcode für Powershell eingefügt.

$ae = New-aeConnection -profile client1000

# Titel von JOB.WINDOWS anpassen
$obj = Open-aeObject -ae $ae -name JOB.WINDOWS -readwrite
$obj.header().setTitle("Neuer Objekttitel")
Save-aeObject -ae $ae -object $obj -close

# Neuen Ordner erstellen und Objekt reinschieben
New-aeFolder -ae $ae -path /DEMO/WFC_DEMO_OBJEKT -title "Mich gibts fuer den Blog."
Move-aeObject -ae $ae -name JOB.WINDOWS -path /DEMO/WFC_DEMO_OBJEKT

# Prüfen ob Objekt noch da ist 
$objectinfo = Get-aeObjectProperties -ae $ae -name JOB.WINDOWS
if ($objectinfo) {
  Write-Host "Wir sollten aufraeumen! Folgende Objekte sind noch in dem Ordner:"
  Search-aeObject -ae $ae -path $objectinfo.path -NonRecursiveSearch
}

# Objekt exportieren und löschen..
Export-aeObject -ae $ae -name JOB.WINDOWS -file C:\temp\backup.xml
Remove-aeObject -ae $ae -name JOB.WINDOWS
Remove-aeObject -ae $ae -path /DEMO/WFC_DEMO_OBJEKT 

# ...und tschüss!
$ae.bye()

Einen kleinen Vorgeschmack auf das E-Learning können Sie sich bereits auf Yotube holen. Unter diesem Link finden Sie eine Live-Demo.

Das E-Learning können Sie sich hier ansehen: WFC::Core – Powershell und die Automic Automation Engine

Es kostet 1999€ und ist kompatibel zu der Powershell v3+ und der AE10+. Eine englische Version ist in Arbeit.

Haben Sie Interesse? Unter http://workflowcommander.ch finden Sie mehr Informationen über den WorkflowCommander. Außerdem können Sie sich gerne mit Fragen an mich wenden, per E-Mail oder auf Xing / LinkedIn. Wenn Sie einfach nur eine Benachrichtigung wollen, sobald das E-Learning verfügbar ist, melden Sie sich über das folgende Eingabefeld für den auch ansonsten sehr lesenswerten Newsletter von Philipp Elmer an.

Von |2017-11-05T10:54:23+01:0030. August 2017|Kategorien: AutomicBlog|Kommentare deaktiviert für Gastbeitrag: Mit Powershell die Automatisierung automatisieren

Share This Story!

Today’s article comes from Joel Wiesmann, a friend of mine and an Automic expert from Switzerland, who already published an article here in the blog around a year ago.

In this article he tells us  about the ApplicationInterface API, Powershell and his new e-learning, where you learn to use both together.

As an Automation Engineer, I work a lot with JOBS objects. Every day, I see and create solutions with AE Script, Windows CMD, Perl, Bash and Powershell. Sometimes it’s simple tasks, sometimes more complex. The fact is, scripting languages accompany me day by day and my knowledge about it makes up a large part of my value in the working world.

Because of that, it has always annoyed me that my daily activities with the Automation Engine – like creating, copying and changing objects – could not be automated by means of my well-known and well-loved scripting languages.

Can you already guess what I’m going for? The ApplicationInterface is Automic’s own Java Library, with which the „old“ fatclient was implemented. So, if you are looking for automation solutions for the Automation Engine, you will find almost exclusively Java-implemented programs.

It’s Some Stale Coffee

I’ve got some issues with Java.

I’m a scripter. I like transparent solutions that are developed quickly and do not need a development environment the size of an Oracle installation. Even if I overlook this and write my scripts around the Java programs – I have a break in the programming language. And this break will get visible once there are new requirements.

If programming with the ApplicationInterfaces in Java is the slow craft of brewing coffee, implementing it with Powershell is Nespresso.

Let’s take the following fictional conversation between the Job creator Joe Job and the Java developer Jasmin Java:

Joe Job: „I want to export all objetcs from the file objects.txt.“

Jasmin Java: „Okay, use mytool.jar with the parameter -f objects.txt“

Joe Job: „… could we add a filter for the date? So, only the objects of the last 12h?“

Jasmin Java: „Okay, I added the -h parameter. “

Joe Job: „… and if I only want the objects that are not on agent 2000?“

Jasmin Java: „Phew… -C “

Joe Job: „Cool. Oh, and is the program also able to do imports?“

Jasmin Java: „…!!!!“

Does that sound familiar? Do you wish, you could write flexible solutions with a script language? Starting at the end of September 2017, PhilippElmer.com will provide you with an eLearning, which will teach you how to use Windows Powershell to address the ApplicationInterface API.

eLearning: WorkflowCommander Core

With this eLearning you will get:

  • WorkflowCommander Core – a Powershell Module with more than 20 ready-to-use Cmdlets to access and work with the AE
  • Descriptions and examples for the Cmdlets
  • Tips and tricks for the usage of the ApplicationInterface API an the Powershell
  • Workshops with entertaining hands-on examples
  • Six months of access to the course materials including updates for this time frame

You want an example? Here are some lines of Powershell code.

$ae = New-aeConnection -profile client1000

# Titel von JOB.WINDOWS anpassen
$obj = Open-aeObject -ae $ae -name JOB.WINDOWS -readwrite
$obj.header().setTitle("Neuer Objekttitel")
Save-aeObject -ae $ae -object $obj -close

# Neuen Ordner erstellen und Objekt reinschieben
New-aeFolder -ae $ae -path /DEMO/WFC_DEMO_OBJEKT -title "Mich gibts fuer den Blog."
Move-aeObject -ae $ae -name JOB.WINDOWS -path /DEMO/WFC_DEMO_OBJEKT

# Prüfen ob Objekt noch da ist 
$objectinfo = Get-aeObjectProperties -ae $ae -name JOB.WINDOWS
if ($objectinfo) {
  Write-Host "Wir sollten aufraeumen! Folgende Objekte sind noch in dem Ordner:"
  Search-aeObject -ae $ae -path $objectinfo.path -NonRecursiveSearch
}

# Objekt exportieren und löschen..
Export-aeObject -ae $ae -name JOB.WINDOWS -file C:\temp\backup.xml
Remove-aeObject -ae $ae -name JOB.WINDOWS
Remove-aeObject -ae $ae -path /DEMO/WFC_DEMO_OBJEKT 

# ...und tschüss!
$ae.bye()

You can get a first impression of the eLearning on Youtube. This link will lead you to a live demonstration.

The eLearning is available in German and you can take a look at it here: WFC::Core – Powershell und die Automic Automation Engine

The English version is in the making but will take some more time. Like the German version, it will cost 1999€ and is compatible with Powershell v3+ and AE10+.

Are you interested? You can find more information at http://workflowcommander.ch. And if you have questions, you’re welcome to contact me via mail or Xing / LinkedIn. If you just want to get a notification once the video is ready, you may subscribe to the newsletter of Philipp Elmer. He will inform you, once everything is set up.

Von |2022-06-30T13:07:39+02:0030. August 2017|Kategorien: AutomicBlog|Kommentare deaktiviert für Guest Post: Automize Your Automization

Share This Story!

Titel

Nach oben