PowerShell PackageManagement (OneGet) - Install Apps from Command Line  

Page 7 of 14 FirstFirst ... 56789 ... LastLast

  1. Posts : 276
    Windows 10 Insider Program, Linux Mint 19, Arcolinux, MX-17
       #60

    rmonroe36 said:
    Thanks very much for your testing and help. I'll keep watch for further developments.

    Rich
    Kari,
    Tried my hand with a short script and different approach and was successful. This is what I did:
    <#
    # $MyPackages is array of packages to be installed
    #>


    $MyPackages = "audacity", "ccleaner", "cdburnerxp", "classic-shell", "defraggler", "everything", "firefox -RequiredVersion 37.0.1", "googleearth", "opera-beta", "lastpass", "malwarebytes", "picasa", "revouninstallerpro", "skype", "speccy", "teamviewer","thunderbird", "treesizefree", "utorrent", "vlc", "windirstat"


    foreach ($item in $MyPackages)
    {$item
    Install-Package $item -WhatIf
    }
      My Computer

  2. Kari's Avatar
    Posts : 17,113
    Windows 10 Pro
    Thread Starter
       #61

    That's interesting to know!
      My Computer

  3. Kari's Avatar
    Posts : 17,113
    Windows 10 Pro
    Thread Starter
       #62

    @rmonroe36, this WaitHandles bug seems to be fixed in Build 10074, at least I am no longer getting the error when installing 12 to 15 apps with one command.

    If you test it, please let me know if it works for you.
      My Computer

  4. Kari's Avatar
    Posts : 17,113
    Windows 10 Pro
    Thread Starter
       #63

    Note   Note
    There were a bug in PowerShell in last builds making changing the script execution policy impossible, therefore the OneGet did not work properly.

    The bug was fixed in Build 10158 and OneGet works again exactly as told in this tutorial.

    :) Kari
      My Computer


  5. Posts : 276
    Windows 10 Insider Program, Linux Mint 19, Arcolinux, MX-17
       #64

    Kari said:
    Note   Note
    There were a bug in PowerShell in last builds making changing the script execution policy impossible, therefore the OneGet did not work properly.

    The bug was fixed in Build 10158 and OneGet works again exactly as told in this tutorial.
    :) Kari
    Yes, I had experienced that bug and had me crazy for a while. Some research led me to Gpedit. I forgot the details but a policy change fixed that bug. But no need for that now - all is well with my script that you previously helped with.

    Rich
      My Computer

  6. Wynona's Avatar
    Posts : 25,896
    Windows 10 1909 Build 18363.657
       #65

    Well, first thing I seem to get wrong is that when I run PowerShell ISE as Admin, instead of saying PS C:\Users\myid> it gives me PS C:\WINDOWS\System 32.

    Does this make a difference?
      My Computer

  7. Kari's Avatar
    Posts : 17,113
    Windows 10 Pro
    Thread Starter
       #66

    Wynona said:
    Well, first thing I seem to get wrong is that when I run PowerShell ISE as Admin, instead of saying PS C:\Users\myid> it gives me PS C:\WINDOWS\System 32.

    Does this make a difference?
    No, that is normal. Whenever you run an admin (elevated) Command Prompt, PowerShell or PowerShell ISE, the default working folder is C:\Windows\System32. The CD command works in PowerShell exactly as in Command promt; assuming that your user profile folder would be C:\Users\Wynona you can "jump" to it with CD C:\Users\Wynona.

    The default working folder in normal (not elevated) Command Prompt, PowerShell or PowerShell ISE is the user profile folder.

    The instructions in tutorial are valid both when using an admin or normal PowerShell, with one difference: To get the full script execution rights in admin PowerShell the cmdlet Set-ExecutionPolicy Unrestricted is enough. When doing this in normal non-elevated PowerShell, you need to tell PowerShell that the rights should be granted to current user by adding the -Scope switch with CurrentUser parameter.

    Like this:

    • Execution rights when using elevated PowerShell:
      Code:
      Set-ExecutionPolicy Unrestricted
    • Execution rights when using non-elevated PowerShell:
      Code:
      Set-ExecutionPolicy Unrestricted -Scope CurrentUser
      My Computer


  8. Wynona's Avatar
    Posts : 25,896
    Windows 10 1909 Build 18363.657
       #67

    When I type Get-Command -Module OneGet, I don't get the list of cmdlets you show.

    Should I?
      My Computer

  9. Wynona's Avatar
    Posts : 25,896
    Windows 10 1909 Build 18363.657
       #68

    Kari said:
    No, that is normal. Whenever you run an admin (elevated) Command Prompt, PowerShell or PowerShell ISE, the default working folder is C:\Windows\System32. The CD command works in PowerShell exactly as in Command promt; assuming that your user profile folder would be C:\Users\Wynona you can "jump" to it with CD C:\Users\Wynona.

    The default working folder in normal (not elevated) Command Prompt, PowerShell or PowerShell ISE is the user profile folder.

    The instructions in tutorial are valid both when using an admin or normal PowerShell, with one difference: To get the full script execution rights in admin PowerShell the cmdlet Set-ExecutionPolicy Unrestricted is enough. When doing this in normal non-elevated PowerShell, you need to tell PowerShell that the rights should be granted to current user by adding the -Scope switch with CurrentUser parameter.

    Like this:

    • Execution rights when using elevated PowerShell:
      Code:
      Set-ExecutionPolicy Unrestricted
    • Execution rights when using non-elevated PowerShell:
      Code:
      Set-ExecutionPolicy Unrestricted -Scope CurrentUser
    Should I set the Execution Policy before I enter Get-Command -Module OneGet or afterwards?
      My Computer

  10. Kari's Avatar
    Posts : 17,113
    Windows 10 Pro
    Thread Starter
       #69

    Wynona said:
    Should I set the Execution Policy before I enter Get-Command -Module OneGet or afterwards?
    The tutorial was written almost a year before Windows 10 was released, in October 2014. Quite a lot have been changed, I realize I have to edit the tutorial and bring it up-to-date.

    Everything still works as told in tutorial, but there are some minor changes. One of these changes is the change of the module name: OneGet commands are now listed in module PackageManagement.

    Use Get-Command -Module PackageManagement to get list of OneGet commands.
      My Computer


 

Tutorial Categories

PowerShell PackageManagement (OneGet) - Install Apps from Command Line Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


Related Threads
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:41.
Find Us




Windows 10 Forums