Move Data and Create Shortcuts Scripts

I need to move users Desktop data, as some are 1GBs in sizes to there home drives (my documents) and create shortcuts in there place. 

How is this best achieved

July 5th, 2015 3:57am

Here is something to get you started:

$WScriptShell = New-Object -ComObject WScript.Shell
Get-ChildItem "$env:USERPROFILE\Desktop" -Exclude "*.url", "*.lnk" |
    ForEach-Object {
        $Moved = Move-Item -Path $_.FullName -Destination "$env:USERPROFILE\Documents" -PassThru
        $TargetFile = $Moved.FullName
        $ShortcutFile = $_.FullName -replace $_.Extension, '.lnk'
        $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
        $Shortcut.TargetPath = $TargetFile
        $Shortcut.Save()
    }

Free Windows Admin Tool Kit Click here and download it now
July 5th, 2015 5:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics