CIAO
Ho scritto questo script:
e l'ho eseguito cosi`:codice:param($RemovedSID,$RemAccNameDel) function KeyAndItemDeleted ($StartKey) { if ($StartKey -eq 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\PurgeAtNextLogoff') { Remove-ItemProperty -LiteralPath $StartKey -Name $RemovedSID -WhatIf } else { Remove-Item $StartKey'\'$RemovedSID -WhatIf } } if (('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\PurgeAtNextLogoff.'+$RemovedSID)) { KeyAndItemDeleted -StartKey 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\PurgeAtNextLogoff' }
ma ottengo:codice:powershell -ExecutionPolicy Unrestricted -file "D:\Users\xxx\Documents\b.ps1" "S-1-5-21-152799110-1058532297-3105840818-1000" "AccountNameDeleted"
Come mai?codice:WhatIf: Esecuzione dell'operazione "Rimuovi proprietà" sulla destinazione "Eleme nto: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\Purge AtNextLogoff Proprietà: S-1-5-21-152799110-1058532297-3105840818-1000". Remove-ItemProperty : Proprietà S-1-5-21-152799110-1058532297-3105840818-1000 n on esistente nel percorso HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Current Version\NetCache\PurgeAtNextLogoff. In D:\Users\Francesca_Ciani\Documents\b.ps1:7 car:31 + Remove-ItemProperty <<<< -LiteralPath $StartKey -Name $RemovedSID -WhatIf + CategoryInfo : InvalidArgument: (S-1-5-21-152799...3105840818-1 000:String) [Remove-ItemProperty], PSArgumentException + FullyQualifiedErrorId : System.Management.Automation.PSArgumentException ,Microsoft.PowerShell.Commands.RemoveItemPropertyCommand
GRAZIE
CIAO

Rispondi quotando