Deploy Network Places through GPO --->>> not using the already discussed Shortcuts

RRphotography 21 Reputation points
2021-08-24T16:32:07.307+00:00

Hello,
I was wondering if there is another way to deploy network places through GPO to the clients. Currently I am using the UC>Preferences>Windows Settings>Shortcuts but it is not the same as adding a network place through the menu.

Shortcuts GPO -> objects are created as shortcuts
Standard Network Places -> objects are create as File Folder type

As you can see here below, using the Shortcuts GPO, they appear as a shortcut, while the standard network place is a File Folder type. Furthermore, the Shortcuts GPO are not shown in the left NAV.

Thank you.

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,853 questions
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 39,436 Reputation points
    2021-08-25T10:16:49.16+00:00

    Hello @R99photography,

    Thank you for your question.

    You can do this using the script below inside PowerShell

    cls

    $NetLocName = $args[0]
    $NetLocTargetPath = $args [1]

    if (!(test-Path $NetLocTargetPath)) # -pathType container))
    {
    write-Host "Problem with entered target path:" $ NetLocTargetPath
    write-Host "Exiting..."
    exit
    }

    $ const_NETHOOD = 0x13
    $oApp = new-Object -with Shell.Application
    $oShell = new-Object -with Wscript.Shell

    $NetHood = ($oApp.Namespace($const_NETHOOD)). Self.Path
    $NetLocLocalPath = "$NetHood \$NetLocName"

    if (!(test-Path $NetLocLocalPath -pathType container))
    {
    new-Item $NetLocLocalPath -type directory -force
    attrib "$NetLocLocalPath" + R
    }

    if (! (test-Path "$NetLocLocalPath \ Desktop.ini" -pathType leaf))
    {
    $oFile = new-Item "$NetLocLocalPath \ Desktop.ini" -file type -force
    add-Content $oFile "[.ShellClassInfo]"
    add-Content $ oFile "CLSID2 = {0AFACED1-E828-11D1-9187-B532F1E9575D}"
    add-Content $oFile "Flags = 2"
    attrib "$NetLocLocalPath \ Desktop.ini" + H + S -A
    }

    if ((test-Path "$ NetLocLocalPath \ target.lnk" -pathType leaf))
    {
    $ oLnk = $ oShell.CreateShortcut ("$ NetLocLocalPath \ target.lnk")
    $OldLnk = $oLnk.TargetPath

    if ($OldLnk -ne $NetLocTargetPath)
    {
    $oLnk.TargetPath = $NetLocTargetPath
    $ oLnk.Save()
    }
    }
    other
    {
    $ oLnk = $ oShell.CreateShortcut ("$ NetLocLocalPath \ target.lnk")

    $oLnk.TargetPath = $NetLocTargetPath
    $ oLnk.Save()
    }

    or you can do this via GPO using the instructions below:

    1) Create a folder:
    GPO> User Configuration> Preferences> Windows Settings> Folder Paths :% NetPlacesDir% \ <share name> You may want to set the "Remove this item when no longer applied" checkbox in the "common tab"

    2) Create a link:
    GPO> User Configuration> Preferences> Windows Settings> Shortcut Name : <share name> \ target Destination type: File system Object location : My network Locations Destination path: \ server \ shares \ share.

    3) Create Desktop.ini:
    GPO> User Configuration> Preferences> Windows Settings>

    File path of Ini files :% NetPlacesDir% \ <share name> \ Desktop.ini
    Section name: .ShellClassInfo
    Property name: CLSID2
    Property Value: {0AFACED1-E828-11D1-9187-B532F1E9575D}

    File path:% NetPlacesDir% \ <share name> \ Desktop.ini
    Section name: .ShellClassInfo
    Property Name: Flags
    Property Value: 2

    If the answer was helpful, please don't forget to vote up or accept as an answer, thanks.

    Yours sincerely,

    Samuel L

    0 comments No comments

0 additional answers

Sort by: Most helpful