Category: Powershell

Add a Windows User to Hyper-V Admin Group to allow co-Hyper-V Management

To add a user to the Hyper-V Administrators group, you must already have administrative privileges on the host machine. This process allows standard users to manage virtual machines without giving them full system administrator access.

Option 1: Use PowerShell (Fastest) 

Open Windows Terminal or PowerShell as an Administrator and run the following command: 

powershell

Add-LocalGroupMember -Group “Hyper-V Administrators” -Member “UserName”

Note: Use code with caution.

(Replace “UserName” with the actual account name or “Domain\UserName” for domain accounts).

Option 2: Use Command Prompt 

Run Command Prompt as an Administrator and use this syntax:

cmd

net localgroup “Hyper-V Administrators” “UserName” /add

Note: Group names are localized; if your Windows installation is not in English, use net localgroup to find the exact name of the Hyper-V group on your system.

Option 3: Use Computer Management (Graphical) 

This is the most common method for Windows 10, 11, and Windows Server users.

  1. Right-click the Start button and select Computer Management.
  2. Navigate to System Tools > Local Users and Groups > Groups.
  3. In the right pane, double-click Hyper-V Administrators.
  4. Click Add… and enter the username of the person you want to add.
  5. Click Check Names to verify, then click OK and Apply.
  6. Important: The user must log out and log back in for the changes to take effect.

Deploying Google Drive Shared Drives to Client Workstations

When a client uses Google Workspace and needs their team to access Shared Drives from Windows workstations, we use a standardized PowerShell deployment script. This article walks through what the script does, how to use it, and what the end-user experience looks like.


Prerequisites

Before running the script, make sure the following are in place:

  • Google Drive for Desktop must be installed on the workstation. Download it from https://dl.google.com/drive-file-stream/GoogleDriveSetup.exe and run it before launching the script. The script will check for the installation and exit if it’s not found.
  • Administrator access on the target machine. The script uses #Requires -RunAsAdministrator and will not run without elevation.
  • User accounts must already exist on the machine. The script reads existing profiles from C:\Users and lets you choose which ones to target.

What the Script Does

The script (Ultrex-Deploy-GoogleDrive.ps1) performs four steps:

Step 1: Verify Google Drive Installation

The script looks for C:\Program Files\Google\Drive File Stream\launch.bat. If it’s found, it moves on. If not, it displays the download link and exits so you can install it first and re-run.

Step 2: Configure Auto-Start

It adds a registry entry under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run so that Google Drive File Stream launches automatically when any user signs in. If the entry already exists, it skips this step.

Step 3: Create the Launcher Script

A VBScript file is created at C:\InstallSharedDrive\LaunchGoogleDrive.vbs. This is the logic behind the desktop shortcut. When executed, it:

  1. Checks if GoogleDriveFS.exe is already running.
  2. If not, launches it via launch.bat and waits up to 30 seconds for the mapped drive to appear.
  3. If the drive is mounted, it opens it in File Explorer.
  4. If the drive isn’t available (user hasn’t signed in yet), it displays a popup with step-by-step sign-in instructions directing them to the system tray icon.

The drive letter is configurable — the script prompts you at the start (defaults to G:).

Step 4: Deploy Desktop Shortcuts

Two shortcuts are placed on each selected user’s desktop:

  • Create Shared Drive — Uses the batch file icon. Runs the VBScript launcher, which starts Google Drive if needed and opens the mapped drive letter. This is the primary shortcut for users who need to reconnect or access their Shared Drive.
  • Google Drive — Uses the Google Drive icon. Simply launches Google Drive for Desktop. Useful if a user just needs to start the app or access settings.

Both shortcuts are also placed in C:\Users\Default\Desktop so that any future user accounts created on the machine will automatically receive them on first login.


The Script

Copy the entire block below and paste it into the RMM PowerShell terminal.

powershell

# Ultrex IT - Google Drive Shared Drive Deployment

#Requires -RunAsAdministrator

# --- CONFIGURATION -----------------------------------------------------------

$DriveLetter = Read-Host "Enter drive letter (default: G)"
if ([string]::IsNullOrWhiteSpace($DriveLetter)) { $DriveLetter = "G" }
$DriveLetter = $DriveLetter.TrimEnd(":", " ").ToUpper()

Write-Host ""
Write-Host "Available user profiles:" -ForegroundColor Cyan
$allProfiles = Get-ChildItem "C:\Users" -Directory |
    Where-Object { $_.Name -notmatch '^(Public|Default|Default User|All Users)$' } |
    Select-Object -ExpandProperty Name

$i = 0
foreach ($p in $allProfiles) {
    $i++
    Write-Host "  $i. $p"
}
Write-Host ""
Write-Host "Enter user numbers separated by commas (e.g. 1,2,3)" -ForegroundColor Cyan
Write-Host "Or type 'all' to deploy to everyone" -ForegroundColor Cyan
$selection = Read-Host "Selection"

if ($selection -eq "all") {
    $TargetUsers = $allProfiles
} else {
    $indices = $selection -split "," | ForEach-Object { [int]$_.Trim() - 1 }
    $TargetUsers = @()
    foreach ($idx in $indices) {
        if ($idx -ge 0 -and $idx -lt $allProfiles.Count) {
            $TargetUsers += $allProfiles[$idx]
        }
    }
}

Write-Host ""
Write-Host "Deploying to: $($TargetUsers -join ', ')" -ForegroundColor Green
Write-Host "Drive letter: ${DriveLetter}:\" -ForegroundColor Green
Write-Host ""

# --- STEP 1: Install Google Drive for Desktop --------------------------------
Write-Host "--- Step 1: Google Drive for Desktop ---" -ForegroundColor Cyan

$driveExe = "C:\Program Files\Google\Drive File Stream\launch.bat"

if (Test-Path $driveExe) {
    Write-Host "  [OK]   Google Drive for Desktop found" -ForegroundColor Green
} else {
    Write-Host "  [FAIL] Google Drive for Desktop is NOT installed" -ForegroundColor Red
    Write-Host ""
    Write-Host "  Please install Google Drive for Desktop before running this script." -ForegroundColor Yellow
    Write-Host "  Download from: https://dl.google.com/drive-file-stream/GoogleDriveSetup.exe" -ForegroundColor Yellow
    Write-Host ""
    Read-Host "  Press any key to exit..."
    exit
}

Write-Host ""

# --- STEP 2: Ensure Google Drive auto-starts for all users -------------------
Write-Host "--- Step 2: Auto-Start Configuration ---" -ForegroundColor Cyan

$runKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$existing = Get-ItemProperty $runKey -Name "GoogleDriveFS" -ErrorAction SilentlyContinue

if ($existing) {
    Write-Host "  [SKIP] Auto-start already configured" -ForegroundColor Yellow
} else {
    try {
        New-ItemProperty -Path $runKey -Name "GoogleDriveFS" `
            -Value """C:\Program Files\Google\Drive File Stream\launch.bat""" `
            -PropertyType String -Force | Out-Null
        Write-Host "  [OK]   Auto-start enabled for all users" -ForegroundColor Green
    } catch {
        Write-Host "  [WARN] Could not set auto-start: $($_.Exception.Message)" -ForegroundColor Yellow
    }
}

Write-Host ""

# --- STEP 3: Create the launcher VBScript ------------------------------------
Write-Host "--- Step 3: Creating Launcher Script ---" -ForegroundColor Cyan

$launcherDir = "C:\InstallSharedDrive"
$launcherScript = "$launcherDir\LaunchGoogleDrive.vbs"

if (-not (Test-Path $launcherDir)) {
    New-Item -Path $launcherDir -ItemType Directory -Force | Out-Null
}

$vbsContent = @"
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Check if Google Drive is already running
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
Set colProcesses = objWMI.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'GoogleDriveFS.exe'")

If colProcesses.Count = 0 Then
    driveExe = "C:\Program Files\Google\Drive File Stream\launch.bat"
    If objFSO.FileExists(driveExe) Then
        objShell.Run """" & driveExe & """", 0, False
        WScript.Sleep 5000
        attempts = 0
        Do While Not objFSO.DriveExists("${DriveLetter}:") And attempts < 25
            WScript.Sleep 1000
            attempts = attempts + 1
        Loop
    Else
        MsgBox "Google Drive is not installed." & vbCrLf & "Please contact Ultrex IT support.", vbExclamation, "Google Drive"
        WScript.Quit
    End If
End If

If objFSO.DriveExists("${DriveLetter}:") Then
    objShell.Run "explorer.exe ${DriveLetter}:\"
Else
    MsgBox "Google Drive is not ready yet." & vbCrLf & vbCrLf & "To sign in:" & vbCrLf & "1. Look for the Google Drive icon in the system tray (bottom right)" & vbCrLf & "2. Click it and sign in with your Google account" & vbCrLf & "3. Once signed in, click this shortcut again" & vbCrLf & vbCrLf & "Need help? Contact Ultrex IT.", vbExclamation, "Google Drive"
End If
"@

Set-Content -Path $launcherScript -Value $vbsContent -Force
Write-Host "  [OK]   Launcher script created at $launcherScript" -ForegroundColor Green

Write-Host ""

# --- STEP 4: Deploy shortcuts ------------------------------------------------
Write-Host "--- Step 4: Deploying Desktop Shortcuts ---" -ForegroundColor Cyan

$iconPath = "C:\Program Files\Google\Drive File Stream\drive_fs.ico"
if (-not (Test-Path $iconPath)) {
    $found = Get-ChildItem "C:\Program Files\Google\Drive File Stream" -Filter "*.ico" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
    if ($found) { $iconPath = $found.FullName }
}

$desktops = @()
foreach ($user in $TargetUsers) {
    $desktops += @{ Path = "C:\Users\$user\Desktop"; Name = $user }
}
$desktops += @{ Path = "C:\Users\Default\Desktop"; Name = "Default" }

foreach ($entry in $desktops) {
    $desktop = $entry.Path
    $displayName = $entry.Name

    try {
        if (-not (Test-Path $desktop)) {
            New-Item -Path $desktop -ItemType Directory -Force | Out-Null
        }

        Remove-Item "$desktop\Google Drive G.lnk" -Force -ErrorAction SilentlyContinue

        $wshShell = New-Object -ComObject WScript.Shell

        $shortcut = $wshShell.CreateShortcut("$desktop\Create Shared Drive.lnk")
        $shortcut.TargetPath = "wscript.exe"
        $shortcut.Arguments = """$launcherScript"""
        $shortcut.WorkingDirectory = $launcherDir
        $shortcut.Description = "Launch Google Drive and open ${DriveLetter}:\"
        $shortcut.IconLocation = "C:\Program Files\Google\Drive File Stream\launch.bat,0"
        $shortcut.Save()

        $shortcut2 = $wshShell.CreateShortcut("$desktop\Google Drive.lnk")
        $shortcut2.TargetPath = "C:\Program Files\Google\Drive File Stream\launch.bat"
        $shortcut2.Description = "Google Drive"
        if (Test-Path $iconPath) {
            $shortcut2.IconLocation = "$iconPath,0"
        }
        $shortcut2.Save()

        Write-Host "  [OK]   $displayName" -ForegroundColor Green
    } catch {
        Write-Host "  [FAIL] $displayName - $($_.Exception.Message)" -ForegroundColor Red
    }
}

Write-Host ""
Write-Host "=== Deployment Complete ===" -ForegroundColor Cyan
Write-Host ""
Write-Host "  Drive:      ${DriveLetter}:\" -ForegroundColor Gray
Write-Host "  Users:      $($TargetUsers.Count) + Default profile" -ForegroundColor Gray
Write-Host "  Auto-start: Enabled" -ForegroundColor Gray
Write-Host "  Launcher:   $launcherScript" -ForegroundColor Gray
Write-Host ""
Write-Host "  Each user must sign in to Google Drive on first use." -ForegroundColor Yellow
Write-Host "  They click the system tray icon and authenticate with their Google account." -ForegroundColor Yellow
Write-Host ""
Write-Host "  Ultrex IT - deployment complete" -ForegroundColor Cyan

How to Run It

  1. Confirm Google Drive for Desktop is already installed on the target machine. If not, push the installer first via RMM or install it manually during a remote session.
  2. Open the RMM PowerShell terminal for the target device (e.g., Atera → Manage → Terminal → PowerShell).
  3. Copy the entire contents of Ultrex-Deploy-GoogleDrive.ps1 and paste it into the RMM PowerShell session.
  4. The script will prompt for two things directly in the terminal:
    • Drive letter — Press Enter to accept the default (G), or type a different letter if needed.
    • User selection — The script lists all user profiles on the machine. Enter the numbers separated by commas (e.g., 1,3,5,7) or type all to deploy to every profile.
  5. The script runs through all four steps and reports success or failure for each user.

Example Session

Enter drive letter (default: G):
[Enter]

Available user profiles:
  1. anniek
  2. christinaw
  3. davec
  4. ginaa
  5. jamesa

Enter user numbers separated by commas (e.g. 1,2,3)
Or type 'all' to deploy to everyone
Selection: all

Deploying to: anniek, christinaw, davec, ginaa, jamesa
Drive letter: G:\

--- Step 1: Google Drive for Desktop ---
  [OK]   Google Drive for Desktop found

--- Step 2: Auto-Start Configuration ---
  [OK]   Auto-start enabled for all users

--- Step 3: Creating Launcher Script ---
  [OK]   Launcher script created at C:\InstallSharedDrive\LaunchGoogleDrive.vbs

--- Step 4: Deploying Desktop Shortcuts ---
  [OK]   anniek
  [OK]   christinaw
  [OK]   davec
  [OK]   ginaa
  [OK]   jamesa
  [OK]   Default

=== Deployment Complete ===

End-User Experience

After deployment, each user will see two new icons on their desktop. Here’s what their first-time experience looks like:

  1. User signs in to Windows.
  2. Google Drive for Desktop auto-launches (via the registry Run key).
  3. The Google Drive system tray icon appears (bottom-right of the taskbar).
  4. User clicks the “Create Shared Drive” shortcut on their desktop.
  5. If they haven’t signed in to Google yet, a popup appears with instructions to click the system tray icon and authenticate with their Google account.
  6. After signing in, the G: drive mounts automatically.
  7. Clicking “Create Shared Drive” again opens G:\ in File Explorer.

From that point forward, Drive auto-starts on login, G: mounts automatically, and the shortcut just opens the drive.


Troubleshooting

Script exits immediately saying Google Drive is not installed Install Google Drive for Desktop first, then re-run the script. The installer can be downloaded from the URL shown in the error message.

Shortcuts appear but the drive letter never mounts The user needs to sign in to Google Drive. Have them click the Google Drive icon in the system tray and authenticate with their Google Workspace account.

Drive mounts as a different letter than expected Google Drive for Desktop assigns the drive letter automatically. If G: is already taken, it may use H: or another letter. You can re-run the script with the correct letter, or configure the drive letter in Google Drive’s settings (system tray icon → Preferences → Google Drive → Drive letter).

Shortcuts don’t appear for a new user account The script deploys to the Default profile, so new accounts should get the shortcuts automatically. If they don’t, re-run the script and select the new user.


File Locations

ItemPath
Deployment scriptUltrex-Deploy-GoogleDrive.ps1
VBScript launcherC:\InstallSharedDrive\LaunchGoogleDrive.vbs
Auto-start registry keyHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\GoogleDriveFS
Google Drive installationC:\Program Files\Google\Drive File Stream\
User shortcutsC:\Users\<username>\Desktop\Create Shared Drive.lnk
Default profile shortcutC:\Users\Default\Desktop\Create Shared Drive.lnk

© 2026 Ultrex Staff

Theme by Anders NorenUp ↑