Windows server 2012 r2 server core powershell

В этой статье мы рассмотрим, как обновить версию Windows PowerShell до актуальной 5.1 и установить (обновить) PowerShell Core 7.3. В предыдущей статье мы рассказывали, что на данный момент есть две ветки PowerShell:

  • старая версия Windows PowerShell (максимальная версия 5.1, которая более не развивается);
  • новая платформа PowerShell Core (сейчас доступна версия 7.3).

Несмотря на то, что нумерация версий PowerShell продолжается с 5.1 (6.0, 6.1, 7.0 и т.д.), это две разные платформы. Соответственно мы отдельно рассмотрим как обновить Windows PowerShell и PowerShell Core.

PowerShell Core 7.x максимально совместима с Windows PowerShell. Это означает, что вы можете запускать свои старые скрипты и командлеты в PowerShell Core.

Содержание:

  • Обновление Windows PowerShell до 5.1
  • Установка/обновление PowerShell Core 7.x
  • Установка/обновление PowerShell Core на удаленных комьютерах
  • Обновление PowerShell через Windows Update или WSUS

Обновление Windows PowerShell до 5.1

Во всех версиях, начиная с Windows 10 и Windows Server 2016, Windows PowerShell 5.1 уже установлен по-умолчанию.

В предыдущих версиях (Windows 7/8.1 и Windows 2008 R2/2012) обновление до PowerShell 5.1 нужно выполнять вручную. Например, в Windows Server 2012 R2 (Windows 8.1) установлен PowerShell 4.0.

Попробуем обновить версию Windows PowerShell в Windows Server 2012 R2 до версии 5.1.

Сначала проверьте текущую версию PowerShell (на скриншоте видно, что это PowerShell 4.0):

$PSVersionTable.PSVersion

$PSVersionTable.PSVersion версия powershell

Чтобы обновить вашу версию PowerShell до 5.1, нужно установить пакет Windows Management Framework (WMF) 5.1, который в свою очередь требует наличия .NET Framework 4.5.2 (или более поздней версии). Убедитесь, что у вас установлена версий .NET 4.5.2 или выше командой:

(Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full’ -Name Release).Release

проверить версию .net

В моем случае код 378675 говорит о том, что установлена версия .NET 4.5.1. Поэтому мне нужно скачать и установить более новую .NET Framework 4.8 (ссылка на офлайн установщик https://go.microsoft.com/fwlink/?linkid=2088631 —
ndp48-x86-x64-allos-enu.exe
).

Установите .NET 4.8 (потребуется перезагрузка).

офлайн установка .NET Framework 4.8

Если установить WMF 5.1, но не установить .NET 4.5.2 (или более новый), часть функций PowerShell не будет работать.

Скачайте WMF 5.1 для Windows Server 2012 R2 —
Win8.1AndW2K12R2-KB3191564-x64.msu
(https://go.microsoft.com/fwlink/?linkid=839516).

Установите MSU файл Windows Management Framework 5.1.

установка Windows Management Framework 5.1 kb3191564

После перезагрузки сервера, запустите консоль powershell.exe и убедитесь, что версия была обновлена до PowerShell 5.1.

обновление версии windows powershell до 5.1 в windows server 2012 r2

Если у вас остались снятые с поддержки Windows Server 2008 R2 и Windows 7, вы можете обновить на них версию PowerShell с 2.0 до 5.1 аналогичным способом. Сначала устанавливается .Net Framework 4.5.2 (или выше) и затем WMF 5.1 (ссылки загрузки будут другими, чем для Windows Server 2012 R2).

Установка/обновление PowerShell Core 7.x

PowerShell Core является кроссплатформенной и находится в стадии активной разработки (в отличии от Windows PoweShell 5.1). По сути, PowerShell Core это новая платформа, которая устанавливается в операционной системе вместе с классическим Windows PowerShell. Т.е. нельзя обновить PowerShell 5.1 до PowerShell Core 7.1. PowerShell 7 устанавливается на компьютере отдельно от Windows PowerShell 5.1 (side by side).

На данный момент доступны версии PowerShell Core 6.x и 7.x. Рекомендуется всегда устанавливать последнюю версиях PowerShell (сейчас это 7.3), если вам не требуется особая совместимость с legacy скриптами.

Вы можете обновить (установить) версию PowerShell Core в Windows 10 и 11 несколькими способами:

  • С помощью MSI установщика PowerShell Core, который можно скачать на GitHub
  • С помощью менеджера пакетов WinGet
  • С помощью магазина приложений Microsoft

Далее мы рассмотрим все эти способы на примере обновления PowerShell Core до 7.3 в Windows 10 22H2

Обновить PowerShell Core с помощью MSI установщика

Если вы хотите установить PowerShell Core с помощью MSI пакета, перейдите на старицу проекта https://github.com/PowerShell/PowerShell и скачайте установочный пакет для вашей версии ОС. На момент написания статьи последняя версия v7.3.3 Release of PowerShell от 24 февраля 2023 (например, PowerShell-7.3.3-win-x64.msi или PowerShell-7.3.3-win-x86.msi). Для продуктивной среды используйте Stable или LTS релизы.

скачать MSI установщик PowerShell для windows

Скачайте msi файл и установите его.

Доступны следующие опции установки:

  • Add PowerShell to Path Environment Variable
  • Register Windows Event Logging Manifest (для событий PowerShell будет создан отдельный журнал Event Viewer
    %SystemRoot%\System32\Winevt\Logs\PowerShellCore%4Operational.evtx
    )
  • Enable PowerShell Remoting (включает и настраивает WinRM для PowerShell Remoting)
  • Add ‘Open here’ context menu to Explorer
  • Add ‘Run with PowerShell 7’ context menu for PowerShell files

параметры установки powershell из msi пакета

Далее вы можете включить автоматическое обновление PowerShell Core через WIndows Update/WSUS (рассмотрено ниже).

разрешить автоматическое обновление powershell core 7.2+

Для установки PowerShell Core из MSI пакета средствами SCCM/MDT/скриптами в тихом режиме можно использовать команду установки со следующими параметрами:

  • ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL
  • ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL
  • ENABLE_PSREMOTING
  • REGISTER_MANIFEST
  • ADD_PATH
  • DISABLE_TELEMETRY
  • USE_MU – использовать Microsoft Update для получения обновлений PSCore
  • ENABLE_MU – разрешить обновление PowerShell Core через Windows Update

Например, команда установки может выглядеть так:

msiexec.exe /package PowerShell-7.3.3-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 ADD_PATH=1 ENABLE_MU=1 ADD_PATH=1

Вы можете обновить PowerShell непосредственно из консоли. Чтобы установить или обновиться до последней версии PoSh Core, выполните команду:

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

Данная команда загружает установочный MSI файл PowerShell 7.3 с GitHub и запускает установку через MSI Installer.

install-powershell.ps1 скрипт обновления powershell

После окончания установки открывается окно PowerShell Core (pwsh.exe), проверьте версию PowerShell и убедитесь, что теперь это PoSh 7.3.3.

Используем менеджер пакетов WinGet для установки/обновления PowerShell Core

Если у вас установлен пакетный менеджер WinGet, вы можете установить или обновить версию PowerShell до актуальной командой:

winget install --id Microsoft.Powershell --source winget

Либо можно установить конкретную версию PowerShell Core:

winget install --id=Microsoft.PowerShell -v "7.1.2" -e

При использовании менеджера пакетов Chocolatey, используйте команды (для 5.1):

choco install powershell -y
choco upgrade powershell -y

Для обновления PowerShell 7.x:

choco upgrade pwsh -y

Обратите внимание на каталоги различных версий PowerShell:

  • Windows PowerShell 5.1:
    $env:WINDIR\System32\WindowsPowerShell\v1.0
  • PowerShell Core 6.x:
    $env:ProgramFiles\PowerShell\6
  • PowerShell 7.x:
    $env:ProgramFiles\PowerShell\7

Если на компьютере был установлен PowerShell 6.x, то при установке PowerShell 7.3 каталог
$env:ProgramFiles\PowerShell\6
автоматически удаляется.

Обратите внимание, что имя исполняемого файла среды PowerShell изменился. Теперь это
c:\Program Files\PowerShell\7\pwsh.exe
. У него собственная иконка в меню Start.

  • Для запуска Windows PowerShell, основанного на .NET Framework используется команда
    powershell.exe
  • Для запуска PowerShell Core, основанного на .NET Core, нужно использовать команду
    pwsh.exe

powershell core 7 в windows 10

Т.е. теперь на этом компьютере есть две версии: Windows PowerShell 5.1 и PowerShell Core 7.3.

две версии powershell на компьютере core и desktop

Чтобы узнать версию PowerShell можно проверять версию файла pwsh.exe:

(Get-Command 'C:\Program Files\PowerShell\7\pwsh.exe').Version

Так можно проверить версию файла на удаленном компьютере:

Invoke-Command -Computername computer1 -Scriptblock {(Get-Command 'C:\Program Files\PowerShell\7\pwsh.exe').Version}

Чтобы запустить предыдущую версию PowerShell (например 4), используйте команду:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Version 4

Установка PowerShell Core через Microsoft Store

В Windows 10 и 11вы можете установить или обновить PowerShell через магазин приложений Microsoft Store. Приложение PowerShell можно найти в магазине вручную, или воспользуйтесь этой ссылкой.

Также вы можете установить магазинную версию PowerShell через WinGet:

winget search powershell --source msstore
winget install --id 9MZ1SNWT0N5D

Преимущество установки PowerShell Core через Microsoft Store в том, что магазин прилжений будет автоматически контролировать установленную версию PowerShell и автоматически устанавливать обновления по мере их появления.

Вы можете проверить, установлена ли у вас Store версия PowerShell Coreс помощью команды:

Get-AppPackage Microsoft.PowerShell

В этом примере пакет Microsoft.PowerShell_7.3.3.0_x64__8wekyb3d8bbwe установлен.

Но есть и недостатки, связанные с тем, что такой PowerShell будет запускаться в песочнице.

ustanovkaобновление powershell core в windows 10 через microsoft store

Установка/обновление PowerShell Core на удаленных комьютерах

Рассмотрим два сценария установки или обновления версии PowerShell Core на множестве компьютерах.

Обновление PowerShell Core с помощью GPO

В домене Active Directory вы можете централизованно установить и обновить PowerShell Core с помощью групповой политики. Воспользуйтесь возможностями установки программ с помощью MSI пакетов в GPO.

  1. Скачайте установочный MSI файл PowerShell и скопируйте его в каталог SYSVOL на контроллере домена;
  2. Откройте консоль управления доменными GPO (
    gpmc.msc
    ), создайте новую GPO и назначьте ее на OU с компьютерами и серверами;
  3. Перейдите в раздел GPO Computer Configuration –> Software Settings, создайте новый пакет и укажите для него путь к установочному MSI файлу PowerShell в SYSVOL;
    обновление powershell в домене через gpo

    Для более тонкого нацеливания политики на клиентов можно использовать WMI фильтры GPO.

  4. Для обновления групповых политик установки ПО нужно перезагрузить компьютеры. Во время загрузки на всех компьютерах будет установлена новая версия PowerShell.

Обновление PowerShell на удаленных компьютерах из командной строки

Вы можете обновлять PowerShell на удаленных компьютерах из командной строки.

  • Первый способ позволяет удаленно обновить PowerShell на компьютере с помощью MSI установщика в сетевом каталоге:
    Invoke-Command -ComputerName dc01 -ScriptBlock {Start-Process msiexec.exe -ArgumentList '/package "\\srv1\share\PowerShell-7.3.3-win-x64.msi" /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1' -Wait}
  • Следующий скрипт позволит выбрать все активные компьютеры с Windows 10 из домена Active Directory и запустить на каждом из них загрузку и установку PowerShell Core:
    $creds = $(Get-Credential)
    $computers = Get-ADComputer -Filter 'operatingsystem -like "*Windows 10*" -and enabled -eq "true"'
    ForEach ($computer in $computers) {
    Invoke-Command -ComputerName $computer -Credential $creds {iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet"}
    }

Будьте внимательными при использовании команд PowerShell Remoting при подключении к удаленным компьютерам (Enter-PSSession, Invoke-Command). Если вам нужно подключиться к точке управления PowerShell 7 нужно использовать команду:

Enter-PSSession -ComputerName dc01 -ConfigurationName "powershell.7"

Иначе вы подключитесь к точке PowerShell Remoting 5.1.

Обновление PowerShell в Linux дистрибутивах чаще проще всего выполняется через нативный менеджер пакетов.

Обновление PowerShell через Windows Update или WSUS

До версии PowerShell Core 7.2 не поддерживалось автоматическое обновление pwsh.exe. После выхода нового релиза в консоли появилось уведомление:

A new PowerShell stable release is available. Upgrade now, or check out the release page at: https://aka.ms/PowerShell-Release?tag=v7.1.3

Начиная с версии 7.2, PowerShell Core поддерживает автоматическое обновление через Windows Update ( Microsoft Update, Windows Update for Business, внутренний WSUS сервер или SCCM). Для этого при установке MSI пакета нужно включить соответствующие опции.

Проверьте, что в панели управления Settings -> Update and Security -> Windows Update -> Advanced Options теперь включена опция Receive updates for other Microsoft products when you update Windows.

Разрешить Windows получаить обнволения с Windows Update для других продуктов

Теперь, когда вы нажимаете кнопку Check for Updates или запускаете сканирование обновлений через модуль PSWindowsUpdate, вы также будете получать обновления для PowerShell Core.

проверить новые обновления в windows

Running PowerShell scripts on Windows Server 2012 R2 can be a powerful way to automate various tasks and streamline your workflow. PowerShell is a command-line shell and scripting language developed by Microsoft, specifically designed for system administration. In this tutorial, we will guide you through the steps of running PowerShell scripts on Windows Server 2012 R2.

Step 1: Launch the PowerShell Console
Open the start menu and search for “Windows PowerShell.” Click on the PowerShell icon to launch the PowerShell console.

Step 2: Set Execution Policy
By default, the execution policy restricts running PowerShell scripts on a Windows Server. To enable script execution, you need to change the execution policy.

Type the following command in the PowerShell console and press Enter:
“`
Set-ExecutionPolicy RemoteSigned
“`
This command allows the execution of locally created scripts or signed scripts from trusted publishers.

Step 3: Navigate to the Script’s Location
Use the `cd` (Change Directory) command to navigate to the directory where your PowerShell script is located. For example, if your script is in the “C:Scripts” directory, type the following command:
“`
cd C:Scripts
“`

Step 4: Run the PowerShell Script
To run a PowerShell script, type the script’s filename with the “.ps1” extension and press Enter. For example, if your script is named “myscript.ps1,” type the following command:
“`
.myscript.ps1
“`
Press Enter to execute the script. The output of the script will be displayed in the PowerShell console.

Step 5: Execution Policy Changes (Optional)
After running the script, you may want to revert the execution policy to its original state for security reasons. To reset the execution policy to its default value, type the following command and press Enter:
“`
Set-ExecutionPolicy Restricted
“`
This command restores the default execution policy, which only allows the execution of PowerShell commands.

Pros Cons
1. Allows automation and scripting of various tasks. 1. Executing scripts without proper understanding can pose security risks.
2. Provides greater control and flexibility compared to GUI-based tools. 2. Writing scripts may require learning PowerShell syntax and commands.
3. Scripts can be reused and shared across multiple machines. 3. Debugging scripts can be more challenging compared to GUI-based tools.

Video Tutorial: How to install PowerShell 2.0 on Windows Server 2012 R2?

Where is PowerShell in Windows Server 2012?

In Windows Server 2012, PowerShell is a powerful command-line shell and scripting language that is built on top of the .NET framework. Its primary function is to automate administrative tasks and provide a more efficient way to manage and control the server environment.

To locate PowerShell in Windows Server 2012, you can follow these steps:

1. Click on the “Start” button or press the Windows key on your keyboard to open the Start Menu.

2. In the Start Menu, locate the “Windows PowerShell” folder. It is usually found in the “Windows Administrative Tools” section. You can either scroll through the list or use the search bar to find it quickly.

3. Click on the “Windows PowerShell” folder to expand it.

4. Within the folder, you will find two options: “Windows PowerShell” and “Windows PowerShell ISE” (Integrated Scripting Environment). The former represents the standard PowerShell command-line interface, while the latter offers an enhanced scripting environment with additional features like syntax highlighting and debugging.

5. Choose the appropriate option depending on your needs. If you’re just starting with PowerShell, the standard command-line interface should suffice.

By following these steps, you will be able to locate and access PowerShell in Windows Server 2012, allowing you to leverage its powerful features for system administration and automation tasks.

How do I enable PowerShell script on server?

To enable PowerShell script on a server, you need to follow these steps:

1. Open PowerShell as an administrator: Right-click on the Start menu button and select “Windows PowerShell (Admin)” from the context menu.

2. Check the Execution Policy: Run the command `Get-ExecutionPolicy` to see the current execution policy. By default, it is likely set to “Restricted,” which prevents the execution of PowerShell scripts.

3. Change the Execution Policy: To allow script execution, run the command `Set-ExecutionPolicy RemoteSigned`. This execution policy only allows the execution of scripts signed by trusted publishers. However, it allows the execution of local scripts without requiring a digital signature.

4. Confirm the execution policy change: After setting the execution policy, run `Get-ExecutionPolicy` again to verify that it shows “RemoteSigned.”

5. Run PowerShell scripts: Now, you can run PowerShell scripts on the server. To execute a script, open PowerShell, navigate to the script’s location using the `cd` (change directory) command, and then run the script using its file name and extension (e.g., `.scriptName.ps1`).

By following these steps, you can enable the execution of PowerShell scripts on your server without any security or permission issues. However, always exercise caution when running scripts from untrusted sources or those you have not thoroughly reviewed.

Is PowerShell 5.0 is included with Windows Server 2012 R2?

Yes, PowerShell 5.0 is included with Windows Server 2012 R2. It was released as part of the Windows Management Framework (WMF) 5.0 update, which included updates to PowerShell, Windows Management Instrumentation (WMI), and the Server Manager CIM Provider.

Here are the steps to verify that PowerShell 5.0 is included with Windows Server 2012 R2:

1. Open the Start menu or press the Windows key on your keyboard.
2. Type “PowerShell” in the search bar and open the “Windows PowerShell” or “Windows PowerShell ISE” application.
3. Once the PowerShell console or ISE opens, type the following command and press Enter:
“`
$PSVersionTable.PSVersion
“`
4. The output will display the version of PowerShell installed on your system. If it shows as 5.0 or higher, then PowerShell 5.0 is included with Windows Server 2012 R2.

Note: PowerShell versions can also be checked from the “Programs and Features” section in the Control Panel of Windows Server 2012 R2. Look for “Windows Management Framework 5.0” or “Windows Management Framework 5.1” under the installed programs list to verify the installed version of PowerShell.

What version of PowerShell is available for Windows 2012 R2?

PowerShell is a powerful task automation and configuration management framework developed by Microsoft. When it comes to Windows Server 2012 R2, it includes a pre-installed version of PowerShell. Here’s the version information.

Windows Server 2012 R2 comes with PowerShell version 4.0 by default. PowerShell 4.0 introduced several new features and enhancements over its predecessor, such as Desired State Configuration (DSC), enhanced debugging capabilities, and improved language support.

To verify the installed PowerShell version on Windows Server 2012 R2, you can follow these steps:

1. Launch PowerShell: Click on the Start button or press the Windows key, type “PowerShell,” and click on “Windows PowerShell” from the search results.
2. Run the command: In the PowerShell window, type the following command and press Enter:
`$PSVersionTable.PSVersion`

This command will display the PowerShell version information, including the major version, minor version, build version, and revision.

Please note that while PowerShell version 4 is the default version on Windows Server 2012 R2, it is possible to upgrade PowerShell to a newer version manually if desired. However, this answer is based on the assumption that the server is running the default configuration without any additional updates or modifications.

To run a PowerShell script from the Command Prompt (cmd), you can follow these steps:

1. Open the Command Prompt: Press the Windows key, type “Command Prompt,” and click on the application when it appears in the search results.

2. Navigate to the directory containing the PowerShell script: Use the “cd” command to change the directory to where the script is located. For example, if the script is located in “C:Scripts,” type `cd C:Scripts` and press Enter.

3. Run the PowerShell script: Once you’re in the correct directory, you can execute the PowerShell script by entering the following command:

“`
powershell -File scriptname.ps1
“`

Replace “scriptname.ps1” with the actual name of your PowerShell script, including the file extension.

4. Press Enter to run the command, and the PowerShell script will execute.

By following these steps, you’ll be able to run PowerShell scripts directly from the Command Prompt, allowing you to automate various tasks or perform specific operations easily.

How to open PowerShell ISE in Windows Server 2012 R2?

To open PowerShell ISE (Integrated Scripting Environment) in Windows Server 2012 R2, you can follow these steps:

1. Launch the Start Menu: Click on the Windows logo located in the bottom-left corner of your screen or press the Windows key on your keyboard.
2. Search for PowerShell ISE: Begin typing “PowerShell ISE” in the search bar. As you type, the search results will start appearing.
3. Open PowerShell ISE: Once you see “Windows PowerShell ISE” in the search results, click on it to open the application.

Alternatively, you can also use the Run dialog box to open PowerShell ISE:

1. Press the Windows key + R on your keyboard simultaneously. This will open the Run dialog box.
2. In the Run dialog box, type “powershell_ise” (without quotes) and press Enter or click on the OK button.

By following these steps, you should be able to open PowerShell ISE on Windows Server 2012 R2.
{“@context”:”https://schema.org”,”@type”:”FAQPage”,”mainEntity”:[{“@type”:”Question”,”name”:”Where is PowerShell in Windows Server 2012?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”In Windows Server 2012, PowerShell is a powerful command-line shell and scripting language that is built on top of the .NET framework. Its primary function is to automate administrative tasks and provide a more efficient way to manage and control the server environment.nnTo locate PowerShell in Windows Server 2012, you can follow these steps:nn1. Click on the “Start” button or press the Windows key on your keyboard to open the Start Menu.nn2. In the Start Menu, locate the “Windows PowerShell” folder. It is usually found in the “Windows Administrative Tools” section. You can either scroll through the list or use the search bar to find it quickly.nn3. Click on the “Windows PowerShell” folder to expand it.nn4. Within the folder, you will find two options: “Windows PowerShell” and “Windows PowerShell ISE” (Integrated Scripting Environment). The former represents the standard PowerShell command-line interface, while the latter offers an enhanced scripting environment with additional features like syntax highlighting and debugging.nn5. Choose the appropriate option depending on your needs. If you’re just starting with PowerShell, the standard command-line interface should suffice.nnBy following these steps, you will be able to locate and access PowerShell in Windows Server 2012, allowing you to leverage its powerful features for system administration and automation tasks.”}},{“@type”:”Question”,”name”:”How do I enable PowerShell script on server?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”To enable PowerShell script on a server, you need to follow these steps:nn1. Open PowerShell as an administrator: Right-click on the Start menu button and select “Windows PowerShell (Admin)” from the context menu.nn2. Check the Execution Policy: Run the command `Get-ExecutionPolicy` to see the current execution policy. By default, it is likely set to “Restricted,” which prevents the execution of PowerShell scripts.nn3. Change the Execution Policy: To allow script execution, run the command `Set-ExecutionPolicy RemoteSigned`. This execution policy only allows the execution of scripts signed by trusted publishers. However, it allows the execution of local scripts without requiring a digital signature.nn4. Confirm the execution policy change: After setting the execution policy, run `Get-ExecutionPolicy` again to verify that it shows “RemoteSigned.”nn5. Run PowerShell scripts: Now, you can run PowerShell scripts on the server. To execute a script, open PowerShell, navigate to the script’s location using the `cd` (change directory) command, and then run the script using its file name and extension (e.g., `.scriptName.ps1`).nnBy following these steps, you can enable the execution of PowerShell scripts on your server without any security or permission issues. However, always exercise caution when running scripts from untrusted sources or those you have not thoroughly reviewed.”}},{“@type”:”Question”,”name”:”Is PowerShell 5.0 is included with Windows Server 2012 R2?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”Yes, PowerShell 5.0 is included with Windows Server 2012 R2. It was released as part of the Windows Management Framework (WMF) 5.0 update, which included updates to PowerShell, Windows Management Instrumentation (WMI), and the Server Manager CIM Provider.nnHere are the steps to verify that PowerShell 5.0 is included with Windows Server 2012 R2:nn1. Open the Start menu or press the Windows key on your keyboard.n2. Type “PowerShell” in the search bar and open the “Windows PowerShell” or “Windows PowerShell ISE” application.n3. Once the PowerShell console or ISE opens, type the following command and press Enter:n “`n $PSVersionTable.PSVersionn “`n4. The output will display the version of PowerShell installed on your system. If it shows as 5.0 or higher, then PowerShell 5.0 is included with Windows Server 2012 R2.nnNote: PowerShell versions can also be checked from the “Programs and Features” section in the Control Panel of Windows Server 2012 R2. Look for “Windows Management Framework 5.0” or “Windows Management Framework 5.1″ under the installed programs list to verify the installed version of PowerShell.”}},{“@type”:”Question”,”name”:”What version of PowerShell is available for Windows 2012 R2?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”PowerShell is a powerful task automation and configuration management framework developed by Microsoft. When it comes to Windows Server 2012 R2, it includes a pre-installed version of PowerShell. Here’s the version information.nnWindows Server 2012 R2 comes with PowerShell version 4.0 by default. PowerShell 4.0 introduced several new features and enhancements over its predecessor, such as Desired State Configuration (DSC), enhanced debugging capabilities, and improved language support.nnTo verify the installed PowerShell version on Windows Server 2012 R2, you can follow these steps:nn1. Launch PowerShell: Click on the Start button or press the Windows key, type “PowerShell,” and click on “Windows PowerShell” from the search results.n2. Run the command: In the PowerShell window, type the following command and press Enter:n `$PSVersionTable.PSVersion`nnThis command will display the PowerShell version information, including the major version, minor version, build version, and revision.nnPlease note that while PowerShell version 4 is the default version on Windows Server 2012 R2, it is possible to upgrade PowerShell to a newer version manually if desired. However, this answer is based on the assumption that the server is running the default configuration without any additional updates or modifications.”}},{“@type”:”Question”,”name”:”How to run PowerShell script from cmd?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”To run a PowerShell script from the Command Prompt (cmd), you can follow these steps:nn1. Open the Command Prompt: Press the Windows key, type “Command Prompt,” and click on the application when it appears in the search results.nn2. Navigate to the directory containing the PowerShell script: Use the “cd” command to change the directory to where the script is located. For example, if the script is located in “C:Scripts,” type `cd C:Scripts` and press Enter.nn3. Run the PowerShell script: Once you’re in the correct directory, you can execute the PowerShell script by entering the following command:nn “`n powershell -File scriptname.ps1n “`nn Replace “scriptname.ps1″ with the actual name of your PowerShell script, including the file extension.nn4. Press Enter to run the command, and the PowerShell script will execute.nnBy following these steps, you’ll be able to run PowerShell scripts directly from the Command Prompt, allowing you to automate various tasks or perform specific operations easily.”}},{“@type”:”Question”,”name”:”How to open PowerShell ISE in Windows Server 2012 R2?”,”acceptedAnswer”:{“@type”:”Answer”,”text”:”To open PowerShell ISE (Integrated Scripting Environment) in Windows Server 2012 R2, you can follow these steps:nn1. Launch the Start Menu: Click on the Windows logo located in the bottom-left corner of your screen or press the Windows key on your keyboard.n2. Search for PowerShell ISE: Begin typing “PowerShell ISE” in the search bar. As you type, the search results will start appearing.n3. Open PowerShell ISE: Once you see “Windows PowerShell ISE” in the search results, click on it to open the application.nnAlternatively, you can also use the Run dialog box to open PowerShell ISE:nn1. Press the Windows key + R on your keyboard simultaneously. This will open the Run dialog box.n2. In the Run dialog box, type “powershell_ise” (without quotes) and press Enter or click on the OK button.nnBy following these steps, you should be able to open PowerShell ISE on Windows Server 2012 R2.”}}]}

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Although Windows Server Core is a great way of ending up with a slim and trim diet server, it can be a little bit tricky when first getting started configuring it. During my experiments running Server Core VM’s I found that there were a few tools either built into server core or available separately that can help get over this configuration “hump”.

Built-in Tools

  1. SConfig.exe

    SConfig.exe is a built in command line tool (with a simple command line GUI) that allows you to perform some simple configuration tasks on your core installation.

    SConfig.exe

    Some of the functions include:

    1. Renaming the computer
    2. Joining a domain or workgroup
    3. Enabling remote management (Win-RM)
    4. Enabling remote desktop
    5. Installing windows updates
    6. Configure network settings
    7. Change system date/time
    8. Shutdown/reboot server

Other Tools

When installing a new copy of one of the Windows Server Core versions it’s quite useful to install several additional tools that will help manage the server from a command prompt and/or PowerShell console.

  1. Corefig for Windows Server 2012 Core and Hyper-V Server 2012

    Corefig allows you to configure some of the main settings of a Windows Server Core installation as well as installing updates and windows features and roles.

    Corefig PowerShell Application

  2. Windows Update PowerShell Module

    The Windows Update PowerShell module allows you to install windows updates from a PowerShell command line by executing (after installing the module onto the server):

    Get-WUInstall
  3. Remote Server Administration Tools PowerShell module

    The Remote Server Administration Tools PowerShell module is available as an installable feature on Windows Server Core edition. It needs to be first installed by executing the following command at a PowerShell prompt:

    Add-WindowsFeature -Name 'RSAT-AD-PowerShell' -IncludeAllSubFeature
  4. PowerShell Community Extensions

    The PowerShell Community Extensions project provides various useful PowerShell cmdlets. I always install this onto the server and copy the entire PSCX modules folder:

    c:\Program Files (x86)\PowerShell Community Extensions\Pscx3\

    folder into the system modules folder:

    c:\Program Files\WindowsPowerShell\Modules

    This makes the PSCX module available by the import-module command in PowerShell.

Beginning with Windows Server 2012, the core installation mode is now the default and preferred installation mode. For workloads that are supported on Windows Server core, which includes the remote access role and DirectAccess, server core should be used to provide the highest levels of security and availability.

When installing Windows Server 2012/R2 core, the operating system defaults to using the old DOS command prompt. I find this particularly annoying since the majority of administration I do on a server core installation is in PowerShell. Also, most DOS commands can be run from the PowerShell console anyway, so why not have PowerShell as the default shell? Well, that’s easy enough to fix. To begin, at the command prompt enter start powershell.

DirectAccess Windows Server Core PowerShell

In the PowerShell window enter the following command:

Set-ItemProperty -Path ‘HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon’ -Name Shell -Value PowerShell.exe

DirectAccess Windows Server Core PowerShell

Log off the computer and when you log back in, PowerShell will be the default shell! If you need to execute DOS commands that don’t seem to work in PowerShell, simply enter cmd and you’re good to go.

DirectAccess Windows Server Core PowerShell

Posted by Richard M. Hicks on September 24, 2013

Configure Windows Server Core to use PowerShell by Default

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Ubuntu в стиле windows 11
  • Моргает рабочий стол после загрузки windows 10
  • Ssh unprotected private key file windows
  • Microsoft windows server 2016 standard 64 bit russian 1pk dsp oei dvd 16 core
  • Windows server 2016 upgrade