Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.69k stars 1.08k forks source link

Doesn't work anymore. #299

Closed jcovillers closed 4 years ago

jcovillers commented 4 years ago

Hi! The script doesn't work anymore.

1909 18363.720

Disassembler0 commented 4 years ago

Please be more specific. What steps are you taking to run it? What output do you get?

jcovillers commented 4 years ago

I just migrated a few machines from 7 to 10. Until recently the script was working perfectly well.

Since a few weeks, when I run it on the newly migrated machines, it doesn't work anymore. The changes don't apply. Some error messages on paths or registry keys that don't exist.

I think it's from the latest microsoft update?!

Can we generate a log file?

jcovillers commented 4 years ago
Disabling Telemetry...
Disabling Wi-Fi Sense...
Disabling Application suggestions...
Get-ItemProperty : Impossible de trouver le chemin d'accès «
HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount», car il n'existe pas.
Au caractère C:\Users\Ecole\Desktop\Win10-Initial-Setup-Script-master\Win10.psm1:178 : 10
+ ...      $key = Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKCU:\Software\...\DefaultAccount:String) [Get-ItemProperty], ItemNotFo
   undException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Indexation impossible dans un tableau Null.
Au caractère C:\Users\Ecole\Desktop\Win10-Initial-Setup-Script-master\Win10.psm1:179 : 3
+         Set-ItemProperty -Path $key.PSPath -Name "Data" -Type Binary  ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation : (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Disabling Activity History...
Disabling Background application access...
Disabling location services...
Disabling automatic Maps updates...
Disabling Feedback...
Disabling Tailored Experiences...
Disabling Advertising ID...
Disabling Website Access to Language List...
Set-ItemProperty : Impossible de trouver le chemin d'accès «HKCU:\Control Panel\International\User Profile», car il
n'existe pas.
Au caractère C:\Users\Ecole\Desktop\Win10-Initial-Setup-Script-master\Win10.psm1:340 : 2
+     Set-ItemProperty -Path "HKCU:\Control Panel\International\User Pr ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKCU:\Control P...al\User Profile:String) [Set-ItemProperty], ItemNotFo
   undException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Disabling Cortana...
Disabling Error reporting...
Stopping and disabling Connected User Experiences and Telemetry Service...
Stopping and disabling Device Management WAP Push Service...
Disabling implicit administrative shares...
Hiding Account Protection warning...
Disabling Windows Script Host...
Enabling .NET strong cryptography...
Enabling F8 boot menu options...
Setting Data Execution Prevention (DEP) policy to OptOut...
Setting current network profile to private...
Disabling Remote Assistance...
Enabling updates for other Microsoft products...
Disabling Windows Update automatic restart...
Disabling nightly wake-up for Automatic Maintenance...
Disabling Shared Experiences...
Disabling Autoplay...
Disabling Autorun for all drives...
Enabling NTFS paths with length over 260 characters...
Disabling Action Center (Notification Center)...
Disabling Lock screen...
Hiding network options from Lock Screen...
Hiding shutdown options from Lock Screen...
Disabling Lock screen Blur...
Disabling accessibility keys prompts...
Showing task manager details...
Showing file operations details...
Hiding Task View button...
Showing small icons in taskbar...
Setting taskbar buttons to combine when taskbar is full...
Hiding People icon...
Showing all tray icons...
Disabling search for app in store for unknown extensions...
Disabling 'How do you want to open this file?' prompt...
Disabling adding '- shortcut' to shortcut name...
Adjusting visual effects for performance...
Disabling F1 Help key...
Showing known file extensions...
Showing hidden files...
Enabling navigation pane expanding to current folder...
Hiding sync provider notifications...
Hiding recent shortcuts in Explorer...
Changing default Explorer view to This PC...
Hiding Quick Access from Explorer navigation pane...
Showing This PC shortcut on desktop...
Hiding Desktop icon from This PC...
Hiding Documents icon from This PC...
Hiding Downloads icon from This PC...
Hiding Music icon from This PC...
Hiding Pictures icon from This PC...                                                                                    Hiding Videos icon from This PC...                                                                                      Hiding 3D Objects icon from This PC...                                                                                  Disabling creation of thumbnail cache files...                                                                          Disabling creation of Thumbs.db on network folders...                                                                   Disabling OneDrive...
Uninstalling OneDrive...
Uninstalling default Microsoft applications...
Uninstalling default third party applications...
Disabling Xbox features...
Set-ItemProperty : Impossible de trouver le chemin d'accès « HKCU:\Software\Microsoft\GameBar », car il n'existe pas.
Au caractère C:\Users\Ecole\Desktop\Win10-Initial-Setup-Script-master\Win10.psm1:3147 : 2
+     Set-ItemProperty -Path "HKCU:\Software\Microsoft\GameBar" -Name " ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (HKCU:\Software\Microsoft\GameBar:String) [Set-ItemProperty], ItemNotFou
   ndException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Disabling built-in Adobe Flash in IE and Edge...
Disabling Edge preload...
Disabling Edge shortcut creation...
Disabling Internet Explorer first run wizard...
Disabling First Logon Animation...
Disabling media sharing...
Setting Photo Viewer association for bmp, gif, jpg, png and tif...
Adding Photo Viewer to 'Open with...'
Uninstalling Microsoft XPS Document Writer...
Removing Default Fax Printer...

Press any key to continue...
jcovillers commented 4 years ago

What is curious is that the script works on the admin profile but not at all on the user profile.

Disassembler0 commented 4 years ago

I can't reproduce any of the errors on any edition of 1909 or 2004. And I went so far that I even tried it on French Windows. :)

The errors don't even make sense. HKCU:\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount needs to exist. Without it, the user doesn't have any start menu. The same goes for HKCU:\Control Panel\International\User Profile because without that, the user has no locale settings and keyboard. There must be something you've forgot to mention. From the errors it almost looks like you're running the script before the user profile finishes initialization or like you're impersonating a user from different user profile, but in that case I'd expect to see many more errors.

When you say you've "migrated", does it mean clean installation or the in-place upgrade?

Do you use Microsoft account, active directory, or local one?

Can you please write down all the steps you're taking from the end of Windows installation until you get the script output which you've pasted above? Things like how do you create the user, how do you execute the script etc.

Disassembler0 commented 4 years ago

Also, you wrote

script works on the admin profile but not at all on the user profile

Does that user have admin privileges or is really just a regular user? Because if it's regular user, then the script asks for elevation and the tweaks are applied to the elevated user and not the one originally executing the script as you'd expect. See #29 and #274. But this has always worked the same way, it's not a recent change.

jcovillers commented 4 years ago

Okay, I have several computers running Windows 7. Each workstation has a local administrator profile and a local standard user profile. To switch to windows 10, I use the migration tool of microsoft. When the migration is complete, I go to each profile to validate the telemetry options (^^) of microsoft. (the questionnaire that asks to answer yes or no for sending data to microsoft, GPS position etc...). I log in with the standard user profile, run the script and enter the admin credentials when requested.

After reading #29 and #274, I'll try to modify the script to change the standard user account to admin the time to apply the script then switch it back to standard Thx