Windows 10: How run Powershell at the first PC start or before the OS boot

  1.    15 Nov 2017 #1

    How run Powershell at the first PC start or before the OS boot


    I would like to start a powershell script (change the name of the PC):

    1) before the OS boot ( preferible) or
    2) at the first run (just once)

    I prefer the first option but I couldn't find a way to do it.
    About the second option I have tried using a bach file with the commands below:

    PowerShell -Command "Set-ExecutionPolicy Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1 PowerShell C:\Users\<user_name>\Desktop\script.ps1 >> "%TEMP%\StartupLog.txt" 2>&1
    I located it in start
    C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    to execute the powershell file at the first start but it didn't work. If I run manually the powershell file works fine.

    Thanks
      My ComputerSystem Spec

  2. Masterchiefxx17's Avatar
    Posts : 418
    Windows 10 Professional 64bit
       15 Nov 2017 #2

    Are you doing this operation in say a system image of a computer? Are you using System Center to image the PC?

    It is possible to rename the computer, but what do you want to name it to?
      My ComputerSystem Spec

  3.    15 Nov 2017 #3

    Thank you masterchief. I am doing an image deployment to a large number of pc. No I am not using system centre .... the deployment is done by clonezilla server. The script will check the MAC address , change the name of the pc based on the asset number labled on it. Once the image is insalled I would like the script start at the first logon of the pc.
    In this case it will save nt a lot of time.

    Thanks
      My ComputerSystem Spec


 

Related Threads
Hi. I would like to automatize cleaning the Windows 10's start menu from all these default pinned apps that I'm not using. I don't want to remove apps, only unpin from from start. I tried to google help, but didn't find any. There seems to be...
I have seen the fix for this somewhere on 10F, but I can't find it. Right click on start button shows context menu, but on mine the PowerShell commands are missing. If I uncheck the option in taskbar properties/navigation, I get the 2 cmd prompt...
Hi, I've used powershell to remove some apps (like Xbox games). On one account, it cleaned up the start menu just fine. Second account, they were showing on the start menu, so I ran powershell again and verified everything was gone that I...
I run the Powershell command that is supposed to fix the Start button fail (as well as Cortansa etc) and I got this message that I don't know how to interpret. I made sure that Windows Firewall was running too. 'Windows cannot install package...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 18:38.
Find Us