CIAO

Ho provato cosi`:

codice:
# Parametri da inserire in una riga di comando:

# $ProfilesDataDrive                            Variabile che contiene la lettera dell'unita' dei profili e dati degli utenti.

param($ProfilesDataDrive)

# include, nel sistema di indicizzazione, le directory sottostanti.

New-Item "HKLM:\SOFTWARE\Microsoft\Windows Search\CurrentPolicies\DefaultIndexedPaths" -Force
Set-Location "HKLM:\SOFTWARE\Microsoft\Windows Search\CurrentPolicies\DefaultIndexedPaths"
New-ItemProperty . -Name 'file:///C:\Users\*' -Value 'file:///C:\Users\*'
New-ItemProperty . -Name 'file:///C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*' -Value 'file:///C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*'
New-ItemProperty . -Name 'file:///C:\Users\*\AppData\Local\Temp\*' -Value 'file:///C:\Users\*\AppData\Local\Temp\*'
New-Item "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\DefaultIndexedPaths" -Force
Set-Location "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\DefaultIndexedPaths"
New-ItemProperty . -Name 'file:///C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*' -Value 'file:///C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*'
New-ItemProperty . -Name 'file:///C:\Users\*\AppData\Local\Temp\*' -Value 'file:///C:\Users\*\AppData\Local\Temp\*'

# Esclude, nel sistema di indicizzazione, le directory sottostanti.

New-Item "HKLM:\SOFTWARE\Microsoft\Windows Search\CurrentPolicies\DefaultExcludedPaths" -Force
Set-Location "HKLM:\SOFTWARE\Microsoft\Windows Search\CurrentPolicies\DefaultExcludedPaths"
New-ItemProperty . -Name 'file:///C:\Users\Default\AppData\*' -Value 'file:///C:\Users\Default\AppData\*'
New-ItemProperty . -Name 'file:///' $ProfilesDataDrive ':\Users\Default\' -Value 'file:///' $ProfilesDataDrive ':\Users\Default\'
New-Item "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\DefaultExcludedPaths" -Force
Set-Location "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\DefaultExcludedPaths"
New-ItemProperty . -Name 'file:///C:\Users\Default\AppData\*' -Value 'file:///C:\Users\Default\AppData\*'
New-ItemProperty . -Name 'file:///' $ProfilesDataDrive ':\Users\Default\' -Value 'file:///' $ProfilesDataDrive ':\Users\Default\'
ma, quando lo eseguo, mi dice "Impossibile trovare un parametro posizionale che accetta l'argomento ''<Lettera-drive>''". Come mai?

GRAZIE

CIAO