User Tools

Site Tools


start:tips:sap:inst_gui:onuninstallationend

On Uninstallation End

Ce script s'exécute à la fin de de la désinstallation du SAP GUI. Nous faisons le ménage pour supprimer les fichiers copiés manuellement.

ScriptFile = NwEngine.Variables.ResolveString("%SapSrcDir%\CustomerFiles\OnUninstallationEnd.vbs")
 
If NwEngine.Shell.FileExist( ScriptFile ) Then
  NwEngine.Shell.Execute ScriptFile, vbFalse
Else
  strLog = "'" & ScriptFile & "' not found!"
  NwEngine.Context.Log.WriteError strLog
End If

Le contenu du script OnUninstallationEnd.vbs est le suivant

' Récupére le répertoire courant
CurrentDir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
CurrentDir = CurrentDir & "\" 
 
' Création d'un objet FileSystem
Set oFs = CreateObject("Scripting.FileSystemObject")
' Création d'un objet Shell
Set oShell = WScript.CreateObject( "WScript.Shell" )
' Pour l'accès aux variables d'environnemnt
Set oEnv = oShell.Environment("System")
 
' Si le répertoire de logs n'existe pas, le crée
If Not oFs.FolderExists("C:\Logs") Then
  oFs.CreateFolder("C:\Logs")
End If
 
' Création du fichier de log (si le fichier existe, il sera supprimé et remplacé par un nouveau fichier
Set oLog = oFs.CreateTextFile("C:\Logs\OnUninstallationEnd.txt", True)
 
' Signale l'exécution du script
oLog.WriteLine("")
oLog.WriteLine("Client SAP - Exécution du script OnUninstallationEnd.vbs")
' Indique le répertoire dans lequel on se trouve
oLog.WriteLine("Exécution dans le répertoire: " & CurrentDir)
 
oLog.WriteLine("")
oLog.WriteLine(" Activités post désinstallation")
oLog.WriteLine("================================")
 
' Kerberos
Dim strDstFolder, strDstFolderx86, strDstFile, strDstFilex86
oLog.WriteLine("")
oLog.WriteLine(" Efface les librairies Kerberos")
oLog.WriteLine("--------------------------------")
 
' Répertoire pour la librairie 64 bits
strDstFolder    = oShell.ExpandEnvironmentStrings("%ProgramFiles%")
strDstFolder    = strDstFolder & "\SAP"
strDstFolder    = strDstFolder & "\Kerberos"
strDstFile      = strDstFolder & "\"
strDstFile      = strDstFile   & "gx64krb5.dll"
 
' Répertoire pour la librairie 32 bits
strDstFolderx86 = oShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")
strDstFolderx86 = strDstFolderx86 & "\SAP"
strDstFolderx86 = strDstFolderx86 & "\Kerberos"
strDstFilex86   = strDstFolderx86 & "\"
strDstFilex86   = strDstFilex86   & "gsskrb5.dll" 
 
' Supprime les fichiers et répertoires
oLog.WriteLine("Efface le fichier '" & strDstFile & "'") 
If oFs.FileExists(strDstFile) Then
  oFs.DeleteFile(strDstFile), True
End If  
oLog.WriteLine("Efface le répertorie '" & strDstFolder & "'") 
If oFs.FolderExists(strDstFolder) Then
  oFs.DeleteFolder(strDstFolder), True
End If  
 
oLog.WriteLine("Efface le fichier '" & strDstFilex86 & "'") 
If oFs.FileExists(strDstFilex86) Then
  oFs.DeleteFile(strDstFilex86), True
End If
oLog.WriteLine("Efface le répertorie '" & strDstFolderx86 & "'") 
If oFs.FolderExists(strDstFolderx86) Then
  oFs.DeleteFolder(strDstFolderx86), True
End If  
 
 
oLog.WriteLine("")
oLog.WriteLine(" Configuration des variables d'environnemnt SSO")
oLog.WriteLine("------------------------------------------------")
 
oLog.WriteLine("SET SNC_LIB=") 
oEnv("SNC_LIB") = ""
 
oLog.WriteLine("SET SNC_LIB_64=")
oEnv("SNC_LIB_64") = ""
 
' Fermeture du fichier de log
oLog.Close
 
Set oEnv = Nothing
Set oShell = Nothing
Set oFs = Nothing
  • FIXME Gérer les raccourcis dans menu démarrer
  • FIXME Gérer les raccourcis sur le bureau
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
start/tips/sap/inst_gui/onuninstallationend.txt · Last modified: 2022/04/29 10:58 by admin_wiki