Dans le cadre de développement sous SharePoint, il arrive un moment ou il faut faire le testing et le debug. De plus SharePoint est très verbeux et le fichier de Log fait rapidement plusieurs Mb.
Voila donc un petit script qui va recharger toute la config (uniquement sur le serveur de développement et test) à chaque exécution (que vous pouvez totalement personnaliser) :
# IISRESET
Write-Host -ForegroundColor red " ------------------------------------ "
Write-Host -ForegroundColor red " -> IISRESET ...";
Write-Host -ForegroundColor red " ------------------------------------ "
iisreset
Write-Host ""# Stop the services
Write-Host -ForegroundColor red " ------------------------------------ "
Write-Host -ForegroundColor red " -> Stop all SharePoint services ...";
Write-Host -ForegroundColor red " ------------------------------------ "
net stop sptrace
net stop sptimerv3
Write-Host ""# Delete the SharePoint log files
Write-Host -ForegroundColor magenta " ------------------------------------ "
Write-Host -ForegroundColor magenta " -> Delete the SharePoint Log Files ..."
Write-Host -ForegroundColor magenta " ------------------------------------ "
del "C:\LogFolder\*.*"
Write-Host ""# Start the services
Write-Host -ForegroundColor green " ------------------------------------ "
Write-Host -ForegroundColor green " -> Start all SharePoint services ...";
Write-Host -ForegroundColor green " ------------------------------------ "
net start sptimerv3
net start sptrace
Write-Host ""# IISRESET
Write-Host -ForegroundColor red " ------------------------------------ "
Write-Host -ForegroundColor red " -> IISRESET ...";
Write-Host -ForegroundColor red " ------------------------------------ "
iisresetWrite-Host -ForegroundColor green " ------------------------------------ "
Write-Host -ForegroundColor green " -> READY ... "
Write-Host -ForegroundColor green " ------------------------------------ "
Vous pouvez alors ouvrir le fichier de log juste après l’action à suivre et voir le résultat de celui-ci.
PS: N’oubliez surtout pas l’outil DebugView pour suivre l’exécution de son code sans même être connecté sur le serveur
Romelard Fabrice [MVP]
Commentaires
Enregistrer un commentaire