I am trying to automate a process using powershell and as part of that process I want to create a new drive map on a group policy object
The image shows how it is done manually with the group policy management editor manual method
I have tried using
New-PSDrive and New-SmbMapping eg
New-GPO -Name "$gpn" | New-GPLink -Target $target
New-PSDrive –Name “T” –PSProvider FileSystem –Root “\\arc\tms shared\$directory” –Persist
and
New-SmbMapping -LocalPath 'T:' -RemotePath '\\arc\tms shared\$directory' -Persistent:$true
but with no luck
thanks
But, uhmmmm that screen is not a GPO, which is done at the domain level.
You are showing GPP at the client level. Why are you doing per client via script vs at the domain so as machines are added to the domain, and user login, it's automatic? GPP of course in the way to go.
You cannot use New-Gpo for a local GPP setting. The PowerShell docs for that cmdlet specifically states...
In linking the GPO, you have to fully qualify the target and permissions. Again the above doc shows the following example...
There is a tool you can get to assist here and they provide a sample scrip to do GPO drive mapping. See this...
Automating Group Policy Preferences Drive Mapping with PowerShell [VIDEO] They sell a tool for this use case called...