WINDOWS: mudanças entre as edições
Ir para navegação
Ir para pesquisar
(→Uptime) |
|||
Linha 2: | Linha 2: | ||
*[[Get logged users|Get logged users]] | *[[Get logged users|Get logged users]] | ||
=PowerShell= | =PowerShell= | ||
==Install WSL== | |||
Enable Linux Subsystem | |||
<syntaxhighlight lang=powershell> | |||
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux | |||
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform | |||
</syntaxhighlight> | |||
Download Ubuntu WSL | |||
<syntaxhighlight lang=powershell> | |||
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing | |||
# OR | |||
curl.exe -L -o ubuntu-1804.appx https://aka.ms/wsl-ubuntu-1804 | |||
</syntaxhighlight> | |||
Other tools | |||
<syntaxhighlight lang=powershell> | |||
#List | |||
wsl -l | |||
#Set version | |||
wsl --set-version <Distro> 2 | |||
#Set default version | |||
wsl --set-default-version 2 | |||
#List WSLs | |||
wsl --list --verbose | |||
wsl -l -v | |||
</syntaxhighlight> | |||
==RemoteExecution== | ==RemoteExecution== | ||
*[https://www.faqforge.com/windows/create-powershell-session-remote-computer/ Article] | *[https://www.faqforge.com/windows/create-powershell-session-remote-computer/ Article] |
Edição das 12h52min de 22 de novembro de 2019
PowerShell
Install WSL
Enable Linux Subsystem
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Download Ubuntu WSL
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing
# OR
curl.exe -L -o ubuntu-1804.appx https://aka.ms/wsl-ubuntu-1804
Other tools
#List
wsl -l
#Set version
wsl --set-version <Distro> 2
#Set default version
wsl --set-default-version 2
#List WSLs
wsl --list --verbose
wsl -l -v
RemoteExecution
Enable remote execution
Enable-PSRemoting -Force
Test connection
Test-WsMan localhost
Run remote command
$cred=Get-Credential
$sess = New-PSSession -Credential $cred -ComputerName localhost
Enter-PSSession $sess
#<remote command to execute>
Exit-PSSession
Remove-PSSession $sess
Remote execution from a server list
$cred=Get-Credential
foreach($line in [System.IO.File]::ReadLines("c:\list.txt"))
{
$line
$sess = New-PSSession -Credential $cred -ComputerName $line
Enter-PSSession $sess
c:\command_to_execute.exe
Exit-PSSession
Remove-PSSession $sess
}
Get DELL Service TAG
Get-WmiObject win32_SystemEnclosure | select serialnumber
Uptime
Get-WmiObject Win32_OperatingSystem | Select-Object LastBootUpTime
Prompt Method
wmic path Win32_OperatingSystem get LastBootUpTime
Security
Add member to LocalGroup
Add-LocalGroupMember -group administrators -member domain_name\group_name
FailOverManager
Install
Listing windows features
Get-WindowsFeature
Highlight Faiolver feature
Get-WindowsFeature Failover*
Get-WindowsFeature RSAT-Cluster*
Install Windows Feature
Install-WindowsFeature -name Failover-Clustering
Install-WindowsFeature -name RSAT-Clustering
Output
PS C:\Windows\system32> Get-WindowsFeature Failover*
Display Name Name Install State
------------ ---- -------------
[X] Failover Clustering Failover-Clustering Installed
PS C:\Windows\system32> Get-WindowsFeature RSAT-Cluster*
Display Name Name Install State
------------ ---- -------------
[X] Failover Clustering Tools RSAT-Clustering Installed
[X] Failover Cluster Management Tools RSAT-Clustering-Mgmt Installed
[X] Failover Cluster Module for Windows ... RSAT-Clustering-Powe... Installed
[ ] Failover Cluster Automation Server RSAT-Clustering-Auto... Available
[ ] Failover Cluster Command Interface RSAT-Clustering-CmdI... Available
Errors
0xc0000135
Message
--------------------------- ServerManager.exe - Application Error --------------------------- The application was unable to start correctly (0xc0000135). Click OK to close the application. --------------------------- OK ---------------------------
Solution
DISM.exe /online /enable-feature /all /featurename:NetFx3 or DISM.exe /online /enable-feature /all /featurename:NetFx4