I have a script running properly on machines 7, but XP does not run.
If it runs locally, it does what it wants, but via GPO it does not.
The script checks the computer's OU, scans a .csv
file, and places its icons on the user's desktop.
With gpresult
, says that it runs.
In the policy console it gives an error:
An unknown error occurred while data was gathered for this extension. Details: Not found
Script :
$links = Import-Csv -Path \Share$\links.csv
function GetPCOU{
$SysInfo = New-Object -ComObject "ADSystemInfo"
$Computer = [ADSI]("LDAP://{0}" -f $SysInfo.GetType().InvokeMember("ComputerName", [System.Reflection.BindingFlags]::GetProperty, $null, $SysInfo, $null))
return ([ADSI]$Computer.Parent).OU
}
for($i=0; $i-le $links.length-1; $i++){
if ($links[$i].ou -eq (GetPCOU)) {
$shell = New-Object -ComObject WScript.Shell
$desktop = [System.Environment]::GetFolderPath('Desktop')
$shortcut = $shell.CreateShortcut("$desktop\app1.url")
$shortcut.TargetPath = $links[$i].xx
$shortcut.Save()
$shortcut = $shell.CreateShortcut("$desktop\app2.url")
$shortcut.TargetPath = $links[$i].xy
$shortcut.Save()
}
}
Links file:
Ou, app1, app2, appz
OU1, http://xpto.com, http://xxx.xx, http://hhhh.dd
OU2, xxxx, yyyy, zzzz,