| balubeto Dio minore
 
  
 
 Registrato: 19/05/06 09:22
 Messaggi: 757
 
 
 | 
			
				|  Inviato: 08 Lug 2010 19:29    Oggetto: [PS] Problemi con Remove-ItemProperty |   |  
				| 
 |  
				| CIAO 
 Ho scritto questo script:
 
 
  	  | 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'
 }
 
 | 
 
 e l'ho eseguito cosi`:
 
 
  	  | Codice: |  	  | powershell -ExecutionPolicy Unrestricted -file "D:\Users\xxx\Documents\b.ps1" "S-1-5-21-152799110-1058532297-3105840818-1000" "AccountNameDeleted"
 
 | 
 
 ma ottengo:
 
 
  	  | 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
 
 | 
 
 Come mai?
 
 GRAZIE
 
 CIAO
 |  |