Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<#
Author : Cristian Schmitt Nieto
Source : https://learn.microsoft.com/en-us/microsoft-365/troubleshoot/updates/office-feature-updates-task-faq
#>

#description: Toggle the built-in "Office Feature Updates" scheduled task to avoid performance issues on multi-session hosts.
#execution mode: Individual
#tags: CSN, Microsoft, Golden Image, Scheduled Task, OfficeUpdates

<#variables:
{
"Action": {
"Description": "Enable or disable the Office Feature Updates scheduled task.",
"DisplayName": "Office Update Task Action",
"IsRequired": true,
"OptionsSet": [
{ "Label": "Enable", "Value": "Enable" },
{ "Label": "Disable", "Value": "Disable" }
]
}
}
#>

param (
[Parameter(Mandatory)]
[ValidateSet("Enable","Disable")]
[string]$Action
)

$TaskName = 'Office Feature Updates'
$TaskPath = '\Microsoft\Office\'

Write-Host "Starting Office Update Task configuration: $Action..."

# Attempt to retrieve the task
$task = Get-ScheduledTask -TaskName $TaskName -TaskPath $TaskPath -ErrorAction SilentlyContinue

if (-not $task) {
Write-Error "Scheduled task '$TaskPath$TaskName' not found."
exit 1
}

switch ($Action) {
'Enable' {
Write-Host "Enabling scheduled task '$TaskPath$TaskName'..."
Enable-ScheduledTask -InputObject $task
Write-Host "Task enabled."
}

'Disable' {
Write-Host "Disabling scheduled task '$TaskPath$TaskName'..."
Disable-ScheduledTask -InputObject $task
Write-Host "Task disabled."
}
}

Write-Host "Completed Office Update Task configuration: $Action"
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<#
Author : Cristian Schmitt Nieto
Source : https://learn.microsoft.com/en-us/troubleshoot/windows-client/group-policy/using-group-policy-objects-hide-specified-drives
#>

#description : Hide or unhide drives in File Explorer by managing the NoDrives policy.
#execution mode: IndividualWithRestart
#tags: CSN, Windows Script, Golden Image, Explorer, Drive Visibility

<#variables:
{
"Action": {
"optionsSet": [
{ "label": "Hide specified drives", "value": "Hide" },
{ "label": "Unhide all drives", "value": "Unhide" }
]
},
"DrivesToHide": {
"description": "Comma‑separated list of drive letters to hide (e.g. C,D,E,F). Only used when Action is Hide.",
"isRequired": false,
"defaultValue": ""
}
}
#>


param(
[ComponentModel.DisplayName('Action')]
[Parameter(Mandatory)]
[ValidateSet('Hide','Unhide')]
[string]$Action = 'Hide',

[ComponentModel.DisplayName('Drives to hide (Only use if Hide Option is selected)')]
[Parameter()]
[string]$DrivesToHide = ''
)

$regPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'

# Ensure the Explorer policy key exists
if (-not (Test-Path $regPath)) {
New-Item -Path $regPath -Force | Out-Null
}

if ($Action -eq 'Unhide') {
if (Get-ItemProperty -Path $regPath -Name 'NoDrives' -ErrorAction SilentlyContinue) {
Remove-ItemProperty -Path $regPath -Name 'NoDrives' -ErrorAction Stop
Write-Host "Removed NoDrives entry; all drives will be visible."
}
else {
Write-Host "NoDrives entry not found; nothing to remove."
}
return
}

# Action = Hide
if ([string]::IsNullOrWhiteSpace($DrivesToHide)) {
throw "DrivesToHide must be specified when Action is 'Hide'."
}

# Drive bitmask map
$driveMap = @{
A=1; B=2; C=4; D=8; E=16; F=32; G=64; H=128;
I=256; J=512; K=1024; L=2048; M=4096; N=8192; O=16384; P=32768;
Q=65536; R=131072; S=262144; T=524288; U=1048576; V=2097152; W=4194304; X=8388608;
Y=16777216; Z=33554432
}

# Parse & validate
$letters = $DrivesToHide.Split(',') | ForEach-Object { $_.Trim().ToUpper() }
$mask = 0
foreach ($letter in $letters) {
if ($driveMap.ContainsKey($letter)) {
$mask += $driveMap[$letter]
}
else {
throw "Invalid drive letter specified: '$letter'"
}
}

# Create or update the NoDrives DWORD
if (Get-ItemProperty -Path $regPath -Name 'NoDrives' -ErrorAction SilentlyContinue) {
Set-ItemProperty -Path $regPath -Name 'NoDrives' -Value $mask -Type DWord -Force
Write-Host "Updated NoDrives to $mask; hidden drives: $($letters -join ', ')."
}
else {
New-ItemProperty -Path $regPath -Name 'NoDrives' -Value $mask -PropertyType DWord -Force | Out-Null
Write-Host "Created NoDrives = $mask; hidden drives: $($letters -join ', ')."
}

Write-Host "Please restart Explorer or reboot for changes to take effect."
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<#
Author : Markus Steigner & Cristian Schmitt Nieto
Source : https://learn.microsoft.com/azure/virtual-desktop/onedrive-remoteapp
#>

#description: Toggle background launch of Microsoft OneDrive for Azure Virtual Desktop RemoteApp sessions
#execution mode: Individual
#tags: CSN, Microsoft, Golden Image, Remote Apps, OneDrive

<#variables:
{
"OneDriveBackgroundLaunch": {
"Description": "Enable or disable launching OneDrive silently in the background for RemoteApp sessions.",
"DisplayName": "OneDrive background launch",
"IsRequired": true,
"OptionsSet": [
{ "Label": "Enable", "Value": "Enable" },
{ "Label": "Disable", "Value": "Disable" }
]
}
}
#>


param (
[Parameter(Mandatory)]
[ValidateSet("Enable","Disable")]
[string]$OneDriveBackgroundLaunch
)

# Registry paths
$tsKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services"
$runKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

# Ensure the TS policy key exists
if (-not (Test-Path $tsKey)) {
New-Item -Path $tsKey -Force | Out-Null
}

switch ($OneDriveBackgroundLaunch) {
"Enable" {
Write-Host "Enabling OneDrive background launch for RemoteApp sessions…"

# 1) Enable enhanced shell experience
if (Get-ItemProperty -Path $tsKey -Name UseShellAppRuntimeRemoteApp -ErrorAction SilentlyContinue) {
Set-ItemProperty -Path $tsKey -Name UseShellAppRuntimeRemoteApp -PropertyType DWord -Value 1 -Force
}
else {
New-ItemProperty -Path $tsKey -Name UseShellAppRuntimeRemoteApp -PropertyType DWord -Value 1 -Force | Out-Null
}

# 2) Add OneDrive to Run, launching in background
$oneDriveExe = Join-Path $env:ProgramFiles "Microsoft OneDrive\OneDrive.exe"
$runValue = "`"$oneDriveExe`" /background"
if (Get-ItemProperty -Path $runKey -Name OneDrive -ErrorAction SilentlyContinue) {
Set-ItemProperty -Path $runKey -Name OneDrive -PropertyType String -Value $runValue -Force
}
else {
New-ItemProperty -Path $runKey -Name OneDrive -PropertyType String -Value $runValue -Force | Out-Null
}
}

"Disable" {
Write-Host "Disabling OneDrive background launch for RemoteApp sessions…"

# Remove the TS shell-experience setting if present
if (Get-ItemProperty -Path $tsKey -Name UseShellAppRuntimeRemoteApp -ErrorAction SilentlyContinue) {
Remove-ItemProperty -Path $tsKey -Name UseShellAppRuntimeRemoteApp -ErrorAction SilentlyContinue
}

# Remove the Run entry for OneDrive if present
if (Get-ItemProperty -Path $runKey -Name OneDrive -ErrorAction SilentlyContinue) {
Remove-ItemProperty -Path $runKey -Name OneDrive -ErrorAction SilentlyContinue
}
}
}

Write-Host "Completed OneDrive background-launch configuration: $OneDriveBackgroundLaunch"