mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-30 22:50:15 +00:00
Create GPO to map study drive
This commit is contained in:
1 parent
621d97fb63
commit
c40e256a9f
3 files changed
+55
-2
No files matched your search
@@ -0,0 +1,30 @@
|
||||
$gp_name = "Map Study Drive"
|
||||
|
||||
New-GPO -Name $gp_name
|
||||
|
||||
$gp = Get-GPO -Name $gp_name
|
||||
$gp_id = $gp.Id
|
||||
|
||||
$create_date = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
|
||||
$xml_path = "{{ policy_path }}\{$gp_id}\User\Preferences\Drives"
|
||||
New-Item -ItemType Directory -Force $xml_path
|
||||
|
||||
$data = @"
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Drives clsid="{8FDDCC1A-0C3C-43cd-A6B4-71A6DF20DA8C}">
|
||||
<Drive clsid="{935D1B74-9CB8-4e3c-9914-7DD559B7A417}" name="{{ study_data_letter }}:" status="{{ study_data_letter }}:" image="0" changed="$create_date" uid="">
|
||||
<Properties action="C" thisDrive="NOCHANGE" allDrives="NOCHANGE" userName="" path="{{ study_data_dfs }}" label="{{ study_data_label }}" persistent="1" useLetter="1" letter="{{ study_data_letter }}"/>
|
||||
</Drive>
|
||||
</Drives>
|
||||
"@
|
||||
|
||||
$data | Out-File $xml_path\Drives.xml -Encoding utf8 -Force
|
||||
|
||||
$DomainInfo = Get-ADDomain
|
||||
$DomainOU = $DomainInfo.DistinguishedName
|
||||
$workbenchOU = (Get-ADOrganizationalUnit -Identity "OU=Workbench,$DomainOU").DistinguishedName
|
||||
|
||||
New-GPLink -Name $gp_name -Target $workbenchOU
|
||||
|
||||
Write-Output "THIS SCRIPT ACTUALLY RAN" | Out-File -FilePath 'C:\eidf\StudyDrive_script.txt'
|
||||
Reference in new issue
Block a user