Die KI von OpenAI ist ja aktuell in aller Munde und täglich finden sich in den Medien neue Artikel zu GPT3 oder GPT-4 mit Tests wie gut oder schlecht etwas funktioniert. Es werden Rufe nach Regulierung von KI Systemen laut und manche sehen auch schon die große Massenarbeitslosigkeit auf uns zukommen. Ob dies alles so eintritt und eine KI bald die Weltherrschaft übernimmt, kann ich als Exchange Admin nicht vorhersagen. Aber mit GPT-3 rumspielen will ich natürlich auch…
Of course I also have the GPT-3 Chat and was amazed at the sometimes very good results, but I quickly found the OpenAI API much more interesting. There is even a PowerShell module that can be used to access the OpenAI API very easily. The PowerShell module can be installed with the following command:
Install modules PowerShellAI
Now only an API key is required, which created here can be used. The API key can then be saved in an environment variable and can therefore be used with the PowerShell module:
$env:OpenAIKey = "APIKEY"
The first scenario that occurred to me was to feed the AI with the errors from the event log and have it suggest a solution. I therefore quickly created a small script:
#OpenAI API Key:
$env:OpenAIKey = "APITOKEN"
$EventLog = Get-EventLog -LogName Application -EntryType Error -After (get-date).AddDays(-1)
$EventLogGroups = $EventLog | group eventid
foreach ($EventLogGroup in $EventLogGroups) {
$Event = $EventLogGroup.Group | select -Unique
$EventID = $Event.EventID
$Message = $Event.Message
$GPT3Answer = Get-GPT3Completion "What could be the solution for this error: $Message"
write-host "EventID: $EventID" -ForegroundColor red
write-host "Message:" -ForegroundColor red
write-host "$Message"
write-host "Proposed solution by GPT-3:" -ForegroundColor green
write-host "$GPT3Answer"
}
Auf meinem Test Exchange Server gibt es leider wenige „echte“ Fehler, die meisten Fehler treten während des Starts oder Runterfahren des Servers auf. So schlecht sind die Antworten allerdings nicht:
I then fed OpenAI with a few errors from a productive Exchange server and the results were surprisingly good. For two errors, the registry key suggested by GPT-3 as a solution even worked. So it's worth testing a little further here.
By the way, GPT-3 can also create quite useful PowerShell scripts for administration. Here is an example:
$Script = Get-GPT3Completion "Create a PowerShell Script to list all Exchange Server Mailbox sizes"
This is the result:
Es gibt einen kleinen Fehler: Die Zeile „Import-Module Exchange“ funktioniert so nicht, da es sich bei den Exchange CMDLets nicht um ein PowerShell Modul, sondern um ein SnapIn handelt. In der Exchange Management Shell selbst funktioniert das Script, da die die CMDLets zur Verfügung stehen und nicht extra geladen werden müssen.
The script actually works, as you can see the size of the administrator mailbox is displayed. If you add a bit of error handling, the script is already finished.
The instructions also work well in German:
Playing around with the OpenAI API is really fun, you find new use cases very quickly:
Many results are already amazingly good, but at the moment you don't have to be afraid of becoming unemployed as an Exchange Admin :-)
However, since the entry hurdle with the OpenAI API is very low, it is worth experimenting with it a little. I'm currently having a lot of fun with it :-)