-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDocker_Demo.ps1
56 lines (40 loc) · 1.14 KB
/
Docker_Demo.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# PowerShell demonstration on Docker
# Written by Frank Lesniak
# Last updated: 2020-04-28
# Install Docker if it isn't already; may require a reboot
# Start docker from start menu
# Hey, the latest tag works for PowerShell!
docker run -it mcr.microsoft.com/powershell
# Open the PowerShell Docker repository:
#https://hub.docker.com/_/microsoft-powershell
# What the heck is the latest?
# Check PowerShell version
$PSVersionTable
# Is this Windows?
$IsWindows
# Get information about the OS
$compInfo = Get-ComputerInfo
$compInfo.OsVersion
$compInfo.WindowsVersion
$compInfo.OsBuildNumber
# Show more specific edition info
$compInfo.OsOperatingSystemSKU
$compInfo.WindowsEditionId
$compInfo.WindowsInstallationType
# Check computer name
hostname
# Check username
whoami
# Close the docker container
exit
# Start a Nano Server container - now that's more exotic!
docker run -it mcr.microsoft.com/powershell:nanoserver-1909
# Is this Windows?
$IsWindows
# Get information about the OS
$compInfo = Get-ComputerInfo
# Failed!
# Check the registry:
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
# Close the docker container
exit