Several years ago, I rolled out SSO for the SAP GUI Windows client using AD Group Policy preferences. These deployed the required DLLs, INI and services files, and system environment settings. The solution worked successfully for years, although IT support occasionally forgot to add a computer account to the AD group used to target the settings.
After 64-bit Windows 8 and Windows 10 clients were introduced, SAP SSO stopped working on newly staged clients. The GPO was assigned, but the DLLs needed to be copied to C:\Windows\SysWOW64 instead of C:\Windows\system32 on these systems. While finalizing the Windows 10 operating system deployment task sequence, I wanted to move the entire SAP GUI SSO configuration into a PowerShell script.
My objective was to support both 32-bit Windows 7 and 64-bit Windows 10. The script should apply all the configuration during client installation, removing the need for the GPO afterwards.
SAP-SSO-Configuration.ps1
I used the following script to configure SAP GUI SSO. I created an SCCM package containing the required files, then added a PowerShell step to the task sequence to run SAP-SSO-Configuration.ps1.
#FileName: SAP-SSO-Configuration.ps1#Author: Ivan Versluis#Creation date: 11-AUG-2016#Description: This PowerShell script is checking hardware architecture and based on that copies SAP SSO DLL files,#SAPlogon.ini configuration, services file and the system environment variables needed. During the SCCM OSD installation#all required files are installed for SAP GUI.#Version Control#1.1 initial version and integration with SCCM OSD-TS. SAPlogon.ini from 28.07.16$architecure=$ENV:PROCESSOR_ARCHITECTUREIf($architecure-eq"amd64"){write-host"Configuring 64bit SAP SSO configuration"Copy-Item-Path"$PSScriptRoot\gsskrb5.dll"-Destination"C:\Windows\SysWOW64"-forceCopy-Item-Path"$PSScriptRoot\gssntlm.dll"-Destination"C:\Windows\SysWOW64"-forceCopy-Item-Path"$PSScriptRoot\gx64krb5.dll"-Destination"C:\Windows\SysWOW64"-forceCopy-Item-Path"$PSScriptRoot\gx64ntlm.dll"-Destination"C:\Windows\SysWOW64"-forceCopy-Item-Path"$PSScriptRoot\sncgss32.dll"-Destination"C:\Windows\SysWOW64"-forceCopy-Item-Path"$PSScriptRoot\sncgss64.dll"-Destination"C:\Windows\SysWOW64"-forceIf((Test-Path"C:\SAP")-eq0){New-Item-Path"C:\SAP"-ItemTypeDirectory}Copy-Item-Path"$PSScriptRoot\saplogon.ini"-Destination"C:\SAP"-forceCopy-Item-Path"$PSScriptRoot\services"-Destination"C:\Windows\System32\drivers\etc"-force[Environment]::SetEnvironmentVariable("SAPLOGON_INI_FILE","C:\SAP\saplogon.ini","Machine")[Environment]::SetEnvironmentVariable("SNC_LIB","gsskrb5.dll","Machine")write-host"Finished 64bit SAP SSO configuration"}Else{write-host"Configuring 32bit SAP SSO configuration"Copy-Item-Path"$PSScriptRoot\gsskrb5.dll"-Destination"C:\Windows\System32"-forceCopy-Item-Path"$PSScriptRoot\gssntlm.dll"-Destination"C:\Windows\System32"-forceCopy-Item-Path"$PSScriptRoot\gx64krb5.dll"-Destination"C:\Windows\System32"-forceCopy-Item-Path"$PSScriptRoot\gx64ntlm.dll"-Destination"C:\Windows\System32"-forceCopy-Item-Path"$PSScriptRoot\sncgss32.dll"-Destination"C:\Windows\System32"-forceCopy-Item-Path"$PSScriptRoot\sncgss64.dll"-Destination"C:\Windows\System32"-forceIf((Test-Path"C:\SAP")-eq0){New-Item-Path"C:\SAP"-ItemTypeDirectory}Copy-Item-Path"$PSScriptRoot\saplogon.ini"-Destination"C:\SAP"-forceCopy-Item-Path"$PSScriptRoot\services"-Destination"C:\Windows\System32\drivers\etc"-force[Environment]::SetEnvironmentVariable("SAPLOGON_INI_FILE","C:\SAP\saplogon.ini","Machine")[Environment]::SetEnvironmentVariable("SNC_LIB","gsskrb5.dll","Machine")write-host"Finished 32bit SAP SSO configuration"}