Garacesh Posted January 5, 2021 Posted January 5, 2021 (edited) Now that we're back in lockdown, all our teaching is going to be via G Suite/Google classroom again. We had significant issues last time where kids where saying they couldn't do their work because their work was saved to our local network and not their Google Drive Drive File Sync is the obvious solution, but since kids can't come into the building, they can't log in here and copy their files. So it falls to me. I have stumbled across PSGSuite, which literally has a command for this exact purpose. Hooray! Import-Module PSGSuite ForEach ($User in (Get-ADUser -filter * -properties mail,homedirectory | where {$_.DistinguishedName -imatch "[color="#FF0000"]OU=Your,OU=Org,OU=Units,DC=Domain,DC=Suffix[/color]"})) { Start-GSDrivefileUpload -User $User.mail -Path $User.HomeDirectory -Recurse -Wait } I've spent all morning trying to script this with GAM and I'm no closer to a solution. By messing around with Get-ChildItem -Directory, I can create folder(s) (stripping out most of the chaff with .FullName).Replace) This isn't quite as useful as it first appears, because it can't nest folders (both Folder/Folder2 and Folder\Folder2) create folders named verbatim in the root of their drive, and this also takes forever as it's calling GAM.exe per every folder. Edit: I know GAM can work with csv's so it's possible I could speed this process up by outputting folder structure to a csv and then issuing one GAM command based on that.... Edit2: Yep, that worked, and will presumably work for files too, but that doesn't fix the non-nesting issue. Using Get-ChildItem -File I can copy files As with directories, this isn't quite as useful as it first appears, as this also takes forever as it's calling GAM.exe per every file. Allegedly GAM has an option for this, which should be GAM user add drivefile localfile P:\ath\To\HomeDrive recursive mergewithparent newfilename "School Documents" but this just doesn't work for me. Anybody else have any ideas? Edited January 7, 2021 by Garacesh speeling iz hared
danielghares Posted January 6, 2021 Posted January 6, 2021 Another solution incase anyone is interested would be rclone, utilizing the --drive-impersonate switch. All it would need is a simple script to iterate through all your user folders and execute the command for each one 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now