0

I need to upload files (like csv, pdf nothing special) to GoogleDdrive folder automatically from a PowerShell script. The problem I faced is that I need to authenticate with Google service account instead of client ID and client Secret. I have tried and searched a lot but in the end I could not find something I can use. I managed to make some scripts that uses direct web requests from PowerShell but I can’t authenticate with the service account because I only have JSON file downloaded from Google. I have also check and tried some PowerShell modules (GMGoogleDrive, GoogleOAuth2 ...) but again no luck. So the first issue is that I can not use the JSON file to authenticate like with the client ID:

Body = @( "refresh_token=$RefreshToken", "client_id=$ClientID","client_secret=$ClientSecret", "grant_type=refresh_token") -join '&' Method = 'Post' ContentType = 'application/x-www-form-urlencoded'

And also cant find a suitable PowerShell module that does the job.

And the second one is that I need to upload the files to GoogleDrive not to GoogleCloudStorage that is associated with the Service account.

If someone can give any clues it will be very helpful.

0 Answers0