我知道如何通过GPO映射networking驱动器,但我想映射一个“networking位置”:
我知道如何通过Windows资源pipe理器将这些添加到工作站本身:
但我不知道如何通过GPO添加/删除它们。
我创build了下面的函数来完成同样的事情。 您可以将其包含为login脚本的一部分。 用法如下:
New-NetworkShortcut -Name 'New Network Shortcut' -Target '\\server\share\path'
function New-NetworkShortcut() { param( [Parameter(Mandatory=$true)] [string]$Name, [Parameter(Mandatory=$true)] [string]$Target ) $networkshortcut_name = $Name $networkshortcut_target = $Target $networkshortcuts_path = [Environment]::GetFolderPath('NetworkShortcuts') $networkshortcut_path = "$networkshortcuts_path\$networkshortcut_name" $desktopini_path = "$networkshortcut_path\desktop.ini" $targetlnk_path = "$networkshortcut_path\target.lnk" $desktopini_text = "[.ShellClassInfo]`r`nCLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}`r`nFlags=2" if( Test-Path -Path $networkshortcut_path -PathType Container ) { Remove-Item -Path $networkshortcut_path -Recurse -Force } [void](New-Item -Path $networkshortcut_path -ItemType directory) Set-ItemProperty -Path $networkshortcut_path -Name Attributes -Value 1 Out-File -FilePath $desktopini_path -InputObject $desktopini_text -Encoding ascii Set-ItemProperty -Path $desktopini_path -Name Attributes -Value 6 $WshShell = New-Object -com WScript.Shell $Shortcut = $WshShell.CreateShortcut($targetlnk_path) $Shortcut.TargetPath = $networkshortcut_target $Shortcut.Save() }
您实际上可以使用组策略映射快捷方式。
使用Server 2012 R2 Essentials ,我从我们公司的SharePoint Online站点映射了一个WebDAV文件夹。
在组策略pipe理编辑器中 :
设置:
笔记: