Run script on XP machines

Asked

Viewed 43 times

0

I have a script running correctly on 7 machines, but not on XP. If it runs locally, do what you want, but not via GPO. The script checks the OR of the computer, checks a file .csv and puts icons respective in the desktop user. With gpresult, says it runs. On the console of the policies 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,

Question on the Soen

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.