-1

誰かがこのスクリプトをチェックして、正しい方向に向けてください。エラーは発生していませんが、スクリプトが期待どおりに機能していません。ログインしたユーザーに基づいて変更されたショートカット ターゲットを達成しようとしています。

#$shell = new-object -com wscript.shell
$loguser="username"
$link ="test1.lnk"
$oldtarget=$link.tragetpath 
$oldpath="c:\notepad.exe"
Get-ChildItem  -Filter $link -Recurse
if ($oldtarget -eq $oldpath)
{
$csvfile=Import-csv "c:\test.csv"
$newtarget=$row.newpath
$user=$row.user
(get-Content $csvfile) | foreach-object {$_.$user -match $loguser} | -replace        $oldtarget $newtarget
}
$link.SaveInfo
4

1 に答える 1