import depuis ancien GitHub

This commit is contained in:
David Wuibaille
2025-10-31 08:38:13 +01:00
parent 6f3aeedc93
commit 6a2f2de58e
745 changed files with 178444 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
Param(
[parameter(Mandatory=$true)][String]$Mycomputer
)
function Log {
param(
[string] $ficherLog,
[string] $ValeurLog
)
#ADD-content $ficherLog -value $ValeurLog
$ValeurLog | Out-File $ficherLog -Append
write-host $ValeurLog
}
function GetHistoriquePC {
param (
$mycomputer,
$logfile
)
Log $logfile "************** HistoriquePC ($mycomputer) **************"
if (test-path "\\$mycomputer\c$") {
$Records = Get-WmiObject -class win32_ReliabilityRecords -computername $mycomputer
foreach ($element in $Records) {
$Date = $element.ConvertToDateTime($element.TimeGenerated)
Log $logfile $Date
Log $logfile $element.ProductName
Log $logfile $element.SourceName
Log $logfile $element.User
Log $logfile $element.Message
Log $logfile "----------------------------------"
}
} Else {
Log $logfile "ERROR"
}
}
$RepTEMP=$ENV:TEMP
$fichierRapport = "$RepTEMP\RightClickEPMHitoPC.log"
if (test-path $fichierRapport) { remove-item $fichierRapport -Recurse -force }
write-host $Mycomputer
GetHistoriquePC $Mycomputer $fichierRapport
if (test-path $fichierRapport) {start-Process $fichierRapport}

View File

@@ -0,0 +1,169 @@
Param(
[parameter(Mandatory=$true)][String]$Mycomputer
)
function Log {
param(
[string] $ficherLog,
[string] $ValeurLog
)
#DD-content $ficherLog -value $ValeurLog
$ValeurLog | Out-File $ficherLog -Append
write-host $ValeurLog
}
function GetComputerDownloadFile {
param (
$mycomputer,
$logfile
)
$PathLog = "\\$mycomputer\c$\Program Files (x86)\LANDESK\LDClient\CurrentDownloads.log"
If (test-path "\\$mycomputer\c$\Program Files\LANDESK\LDClient\CurrentDownloads.log") { $PathLog = "\\$mycomputer\c$\Program Files\LANDESK\LDClient\CurrentDownloads.log" }
Log $logfile "************** DownloadFile ($mycomputer) **************"
if (test-path $PathLog) {
$inf = Get-Content -path $PathLog -Tail 100
Foreach ( $line in $inf ) {
$temp = $line -Split ","
$getDownloadFile = get-content -path $logfile -Tail 10
$sourceDowload = $temp[4]
$sourceDowload = $sourceDowload.Trim()
$nameDowload = $temp[1]
$nameDowload = $nameDowload.Trim()
If ($getDownloadFile -notmatch $sourceDowload ) {
Log $logfile "$sourceDowload;$nameDowload"
}
}
} Else {
Log $logfile "ERROR"
}
}
function GetComputerTaskResult {
param (
$mycomputer,
$taskID,
$logfile
)
Log $logfile "************** GetTaskStatus ($mycomputer) **************"
$PathLog = "\\$mycomputer\c$\Program Files (x86)\LANDESK\LDClient\Data"
If (test-path "\\$mycomputer\c$\Program Files\LANDESK\LDClient\Data") { $PathLog = "\\$mycomputer\c$\Program Files\LANDESK\LDClient\Data" }
$oldtask = "XXXXXXXXXXXXX"
if (test-path $PathLog) {
$Alltask = Get-ChildItem -Path $PathLog -Filter "sdclient_task*.log" -File
Foreach ( $task in $Alltask ) {
$Fullnametask = $task.FullName
$nametask = $task.Name
$nametask = $nametask.replace("sdclient_task","")
$nametask = $nametask.replace(".log","")
if ($nametask -like "*.*") {
$temp2 = $nametask.Split('.')
$nametask = $temp2[0]
}
if (($taskID -eq "ALL") -or ($taskID -eq $nametask)) {
if ($nametask -ne $oldtask) {
Log $logfile "************** $nametask ****************"
}
$inf = Get-Content -path $Fullnametask -Tail 100
Foreach ( $line in $inf ) {
if ($line -like "*processing of package is complete*") {
$temp = $line -Split "result"
$Valeur = "result"+$temp[1]
Log $logfile $Valeur
}
if (($line -like "*Sending task status*") -and ($line -notlike "*ldap=*")) {
$temp = $line -Split "-retcode"
$Valeur = "-retcode"+$temp[1]
Log $logfile $Valeur
}
If ($line -like "*Download Error*") { Log $logfile $line }
If ($line -like "*sdmcache*") { Log $logfile $line }
}
$oldtask = $nametask
}
}
} Else {
Log $logfile "ERROR $NameFolder"
}
}
function GetPolicySyncLog {
param (
$mycomputer,
$logfile
)
Log $logfile "************** GetPolicySync ($mycomputer) **************"
$PathLog = "\\$mycomputer\c$\ProgramData\LANDesk\Log\PolicySync.exe.log"
if (test-path $PathLog ) {
$inf = Get-Content -path $PathLog -Tail 100
Foreach ( $line in $inf ) {
If ($line -like "*Run PolicySync*") { Log $logfile $line }
If ($line -like "*WriteNewPolicies.DownLoadPolicyFile*") { Log $logfile $line }
If ($line -like "*Exit PolicySync*") { Log $logfile $line }
If ($line -like "*PolicyScrubber*") { Log $logfile $line }
If ($line -like "*ShouldRecurring*") { Log $logfile $line }
}
} Else {
Log $logfile "ERROR"
}
}
function GetPreferedserverDAT {
param (
$mycomputer,
$logfile
)
Log $logfile "************** GetPreferedserverDAT ($mycomputer) **************"
$PathLog = "\\$mycomputer\c$\Program Files (x86)\LANDesk\LDClient\sdmcache\preferredservers.dat"
If (test-path "\\$mycomputer\c$\Program Files\LANDesk\LDClient\sdmcache\preferredservers.dat") { $PathLog = "\\$mycomputer\c$\Program Files\LANDesk\LDClient\sdmcache\preferredservers.dat" }
$PrefOK = 0
if (test-path $PathLog) {
$inf = (Get-Content -path $PathLog).replace('?','.').replace("`0", "")
Log $logfile $inf
$PrefOK = 0
}
if ($PrefOK -eq 0) {
Log $logfile "ERROR"
}
}
clear-host
#http://wfr791.pc.kiabi.fr/MBSDKService/MsgSDK.asmx?WSDL/GetMachineData
#$mycreds = Get-Credential -Credential "pc\dwuibail_adm"
#$ldWS = New-WebServiceProxy -uri http://wfr791.pc.kiabi.fr/MBSDKService/MsgSDK.asmx?WSDL -Credential $mycreds
$RepTEMP=$ENV:TEMP
$fichierRapport = "$RepTEMP\RightClickEPMLogcomputer.log"
if (test-path $fichierRapport) { remove-item $fichierRapport -Recurse -force }
GetComputerDownloadFile $Mycomputer $fichierRapport
GetComputerTaskResult $Mycomputer "ALL" $fichierRapport
GetPolicySyncLog $Mycomputer $fichierRapport
GetPreferedserverDAT $Mycomputer $fichierRapport
if (test-path $fichierRapport) {start-Process $fichierRapport}

View File

@@ -0,0 +1,45 @@
Param(
[parameter(Mandatory=$true)][String]$Mycomputer
)
$remote = $Mycomputer
$ErrorActionPreference = "SilentlyContinue"
write-host "***** $remote *****"
write-host "c:\temp"
remove-item "\\$remote\c$\temp\*" -recurse
write-host "c:\windows\temp"
remove-item "\\$remote\c$\windows\temp\*" -recurse
write-host "sdmcache"
remove-item "\\$remote\c$\Program Files (x86)\LANDesk\LDClient\sdmcache\refinst\*" -recurse
write-host "corbeille"
remove-item "\\$remote\c$\$Recycle.Bin\*" -recurse
remove-item "\\$remote\c$\ldprovisioning" -recurse
remove-item "\\$remote\c$\PnPdrivers\*" -recurse
remove-item "\\$remote\c$\mount" -recurse
remove-item "\\$remote\c$\mountW10" -recurse
remove-item "\\$remote\c$\Exploit\Chipset" -recurse
remove-item "\\$remote\c$\Exploit\Intel_HD_Graphics_520_V20.19.15.4457" -recurse
remove-item "\\$remote\c$\Exploit\Video" -recurse
remove-item "\\$remote\c$\exploit\Temp" -recurse
remove-item "\\$remote\c$\Exploit\package" -recurse
remove-item "\\$remote\c$\$WINDOWS.~BT" -recurse
remove-item "\\$remote\d$\sdmcache\refinst\*" -recurse
remove-item "\\$remote\c$\MigrationW10\*" -recurse
remove-item "\\$remote\c$\Exploit\Package\*" -recurse
$Utilisateurs = Get-ChildItem -Path "\\$remote\c$\Users" -Directory -Force
Foreach($Utilisateur in $Utilisateurs) {
write-host $Utilisateur.FullName
remove-item "$Utilisateur.FullName\AppData\Local\Google\Chrome\User Data\Default\*.tmp" -recurse
remove-item "$Utilisateur.FullName\AppData\Local\Google\Chrome\User Data\Default\Cache\*" -recurse
remove-item "$Utilisateur.FullName\AppData\Local\Google\Chrome\User Data\Default\Application Cache\Cache\*" -recurse
remove-item "$Utilisateur.FullName\AppData\Local\Google\Chrome\User Data\Default\GPUCache\*" -recurse
remove-item "$Utilisateur.FullName\AppData\Local\Google\Chrome\User Data\Default\Media Cache\*" -recurse
remove-item "$Utilisateur.FullName\AppData\Local\Google\Chrome\User Data\Default\*.tmp" -recurse
remove-item "$Utilisateur.FullName\\AppData\Local\Temp\*" -recurse
}
$ErrorActionPreference = "Continue"

View File

@@ -0,0 +1,22 @@
Param(
[parameter(Mandatory=$true)][String]$Mycomputer
)
$remote = $Mycomputer
write-host "----------- $Mycomputer ----------------"
If (test-path "\\$Mycomputer\d$\sdmcache\RefInst") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\sdmcache\RefInst\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\sdmcache\vboot") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\sdmcache\vboot\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\c$\Program Files (x86)\LANDesk\LDClient\SDMCache\refinst") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "c:\Program Files (x86)\LANDesk\LDClient\SDMCache\refinst\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\c$\Program Files (x86)\LANDesk\LDClient\SDMCache\vboot") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "c:\Program Files (x86)\LANDesk\LDClient\SDMCache\vboot\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\ImagesPos7") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\ImagesPos7\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\ImagesW7") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\ImagesW7\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\ImagesW8") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\ImagesW8\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\RefInst\ToolsW7") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\RefInst\ToolsW7\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\RefInst\Store\Master\ImagesW10\x64\MUI_LTSB") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\RefInst\Store\Master\ImagesW10\x64\MUI_LTSB\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\RefInst\Store\Master\ImagesW10\x64\MUI_LTSC2019") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\RefInst\Store\Master\ImagesW10\x64\MUI_LTSC2019\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\RefInst\Store\Master\ImagesW2016\x64\ENUS") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\RefInst\Store\Master\ImagesW2016\x64\ENUS\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\RefInst\Store\Master\ImagesW2016\x64\ENUS") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\RefInst\Store\Master\ImagesW2016\x64\ENUS\*" -Force -Recurse} }
If (test-path "\\$Mycomputer\d$\Master$\RefInst\SCX") { invoke-command -computername $Mycomputer -ScriptBlock {Remove-Item -Path "d:\Master$\RefInst\SCX\*" -Force -Recurse} }

View File

@@ -0,0 +1,16 @@
# Add Right-Click Console Commands (Console Extender)
Add handy right-click actions in the Ivanti/LANDESK console using **Console Extender** (browse C$, ping, PsExec shell, remote cleanup, logs, etc.), and to export them for other admin consoles.
![Open Console Extender](https://blog.wuibaille.fr/wp-content/uploads/2024/04/clickEPM01.png)
## What this does
- Adds custom **context-menu commands** to the EPM console (per-device).
- Each command is a simple pair: **Executable** + **Command line**.
- Examples below are ready to paste; replace `<Computer.Device Name>` with the console variable.
## Documentation
For the full documentation, please visit the link below:
[Adding Scripts to the Console](https://blog.wuibaille.fr/2023/04/epm-ajout-de-scripts-dans-la-console/)