denmyos Posted November 2, 2018 Posted November 2, 2018 (edited) Hi I "made" this smale batch to make edge start up with this tabs everytime the computer reboots. I put it in the Startup folder and it seems works ok. The problem is that it has to run on User lever, and in user level the CMD is disabled, but they can run Powershell. So how do make the batch run in Powershell instead? %1 @echo off # setup MS edge with tabs cls start /MIN /B microsoft-edge:"http://www.cnn.com/ start /MIN /B microsoft-edge:"https://www.google.com/ start /MIN /B microsoft-edge:"https://www.cia.gov/ start /MIN /B microsoft-edge:"http://travel.state.gov/ Exit If anybody has a better way to make edge start up with favorite Tab, i'm all ears. It as work from within SCCM. Edited November 2, 2018 by denmyos
Arthur Posted November 2, 2018 Posted November 2, 2018 If anybody has a better way to make edge start up with favorite Tab, i'm all ears. Have you considered using a GPO? https://gpsearch.azurewebsites.net/#14080 https://gpsearch.azurewebsites.net/#13459 The problem is that it has to run on User lever, and in user level the CMD is disabled, but they can run PowerShell. Shouldn't PowerShell be disabled too? There doesn't seem much point in disabling CMD otherwise.
denmyos Posted November 2, 2018 Author Posted November 2, 2018 I can't use GPO cause the computers are not in a Domain I tried Local gpo put that did not do the trick. I agree with you on the powershell,, dont know why its not disable.
Arthur Posted November 2, 2018 Posted November 2, 2018 (edited) So how do make the batch run in Powershell instead? Here's a PowerShell version of your batch file. Start-Process -FilePath "microsoft-edge:https://www.google.co.uk" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://www.bing.co.uk" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://start.duckduckgo.com" -WindowStyle Maximized Edit. With your URLs... Start-Process -FilePath "microsoft-edge:https://www.cnn.com" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://www.google.com" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://www.cia.gov" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://travel.state.gov" -WindowStyle Maximized Edited November 2, 2018 by Arthur
denmyos Posted November 5, 2018 Author Posted November 5, 2018 It seems to work but only half. When i put the script on the desktop and double click it, it works. But when i put in "c:\users\Bruger\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" I get a error ...."is not recognized as the name of a cmdlet function script file or operable program" Any idears?
DJ-1701 Posted November 5, 2018 Posted November 5, 2018 That's odd... it should be a command taken from the standard PowerShell modules... what happens when you add the following line to the start? Import-Module Microsoft.PowerShell.Management[/Code]
denmyos Posted November 6, 2018 Author Posted November 6, 2018 When i open it with Powershell it doesn't work. When i open it with Powershell ISE it works. ?
denmyos Posted November 6, 2018 Author Posted November 6, 2018 Here's a PowerShell version of your batch file. Start-Process -FilePath "microsoft-edge:https://www.google.co.uk" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://www.bing.co.uk" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://start.duckduckgo.com" -WindowStyle Maximized Edit. With your URLs... Start-Process -FilePath "microsoft-edge:https://www.cnn.com" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://www.google.com" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://www.cia.gov" -WindowStyle Minimized Start-Process -FilePath "microsoft-edge:https://travel.state.gov" -WindowStyle Maximized Just to clarify, the "-filePath" do you want the path to MS edge... or do i just leave it blank.?
Arthur Posted November 6, 2018 Posted November 6, 2018 Just to clarify, the "-filePath" do you want the path to MS edge... or do I just leave it blank? You could try adding the full path to Edge, but you shouldn't need it. Does your PowerShell ISE have a different execution policy than PowerShell? Could that be why it isn't running?
denmyos Posted November 6, 2018 Author Posted November 6, 2018 You could try adding the full path to Edge, but you shouldn't need it. Does your PowerShell ISE have a different execution policy than PowerShell? Could that be why it isn't running? Im new at this so i don't really know what you mean, sorry. But i did some fooling around, and put the script in the "Documents" folder.. And they open with no errors.! So it must be a restictions in the "startup" folder They both have "Read-Only" So i don't know what other restrictions the "startup" folder is having.
denmyos Posted November 6, 2018 Author Posted November 6, 2018 I read something about this line powershell.exe -Sta -File script.ps1 That the powershell should start up in -STA!?? Put dont know where to put that line in my script?
denmyos Posted November 6, 2018 Author Posted November 6, 2018 This Start-Process "%windir%\explorer.exe shell:appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" "Microsoft-edge:https://www.cnn.com" Gives me this error in Powershell ISE PS C:\WINDOWS\system32> C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\edge01.ps1Start-Process : This command cannot be run due to the error: The system cannot find the file specified.At C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\edge01.ps1:1 char:1+ Start-Process -Filepath "%windir%\explorer.exe shell:appsfolder\Micro ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: ( [start-Process], InvalidOperationException + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Arthur Posted November 6, 2018 Posted November 6, 2018 (edited) I'm new at this so i don't really know what you mean, sorry. What do you get if you run the following command in both PowerShell and the PowerShell ISE? Are they both set to "RemoteSigned" or something else? Get-ExecutionPolicy So it must be a restrictions in the "startup" folder It could be a restriction since the Startup folder is one of the locations frequently used by malware. Perhaps it might be worth trying a scheduled task that runs the PowerShell script on login? https://blogs.technet.microsoft.com/askpfeplat/2015/04/26/the-startup-script-is-dead Edited November 6, 2018 by Arthur
denmyos Posted November 6, 2018 Author Posted November 6, 2018 i get "Unrestricted" in both. I'll have a look at the schedule task.
denmyos Posted November 7, 2018 Author Posted November 7, 2018 No cigar either. But i don't really know what script parametre to put in,, (if any) I don't understand why its so difficult to have windows 10 start up MS Edge up with tabs.!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now