Blog porusza tematy związane z komputerami i oprogramowaniem. Znajdziecie w nim opisy przydatnych darmowych programów oraz wskazówki dotyczące wydajnego korzystania z komputera. Rady przedstawiane są w minimalistycznej wersji - w treści postów znajduje się konkretne rozwiązanie problemu.
Pokazywanie postów oznaczonych etykietą powershell. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą powershell. Pokaż wszystkie posty
piątek, 18 października 2019
Jak zmienić ustawienia DNS komendą powershell?
Get-NetIPConfiguration
Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses 10.1.1.1, 10.1.1.2, 10.1.1.3
czwartek, 19 lutego 2015
Jak sprawdzić ilosć wolnego miejsca - powershell
Get-CimInstance -ClassName Win32_LogicalDisk |
Where-Object DriveType -eq 3 |
Format-Table @{n='DriveLetter';e={$PSItem.DeviceID}},
@{n='FreeSpace(GB)';e={$PSItem.FreeSpace / 1GB};formatString='N2'},
@{n='Size(GB)';e={$PSItem.Size / 1GB};formatString='N2'},
@{n='Type';e={$PSItem.Description};width=5} -AutoSize
Where-Object DriveType -eq 3 |
Format-Table @{n='DriveLetter';e={$PSItem.DeviceID}},
@{n='FreeSpace(GB)';e={$PSItem.FreeSpace / 1GB};formatString='N2'},
@{n='Size(GB)';e={$PSItem.Size / 1GB};formatString='N2'},
@{n='Type';e={$PSItem.Description};width=5} -AutoSize
czwartek, 22 stycznia 2015
Sprawdzamy czy wszystkie serwery w sieci są dostępne
cls
Write-Host
Write-Host "Checking if PowerShell module for Active Directory is available on this machine..."
$ADModuleAvailable = $null
$ADModuleAvailable = Get-Module -ListAvailable | where {$_.Name -eq "ActiveDirectory"}
if ($ADModuleAvailable -eq $null){
Write-Host -ForegroundColor Red "PowerShell module for Active Directory is not available on this machine."
Write-Host -ForegroundColor Red "Please run this script on a domain controller or on a machine that has Active Directory management tools installed."
Write-Host
Exit}
else{
Write-Host -ForegroundColor Green "PowerShell module for Active Directory is availble."}
Write-Host
Write-Host "Checking if PowerShell module for Active Directory is already loaded..."
$ADModuleLoaded = $null
$ADModuleLoaded = Get-Module | where {$_.Name -eq "ActiveDirectory"}
if ($ADModuleLoaded -eq $null){
Write-Host "Loading PowerShell module for Active Directory ..."
Import-Module -Name "ActiveDirectory"}
Write-Host -ForegroundColor Green "Powershell module for Active Directory is loaded."
Write-Host
$ServerList = $null
$ServerList = Get-ADComputer -Filter '(OperatingSystem -like "*Server*") -AND (Enabled -ne "False")' -Properties DNSHostName | Select-Object DNSHostName | Sort-Object DNSHostName
$IsOnline = $null
ForEach ($Server in $ServerList) {
$IsOnline = Test-Connection -ComputerName $Server.DNSHostName -BufferSize 10 -Count 1 -Quiet
if ($IsOnline -eq $true){
Write-Host -ForegroundColor Green $Server.DNSHostName "is ONLINE"
}
else {
Write-Host -ForegroundColor Red $Server.DNSHostName "is OFFLINE"
}
}
żródło
Write-Host
Write-Host "Checking if PowerShell module for Active Directory is available on this machine..."
$ADModuleAvailable = $null
$ADModuleAvailable = Get-Module -ListAvailable | where {$_.Name -eq "ActiveDirectory"}
if ($ADModuleAvailable -eq $null){
Write-Host -ForegroundColor Red "PowerShell module for Active Directory is not available on this machine."
Write-Host -ForegroundColor Red "Please run this script on a domain controller or on a machine that has Active Directory management tools installed."
Write-Host
Exit}
else{
Write-Host -ForegroundColor Green "PowerShell module for Active Directory is availble."}
Write-Host
Write-Host "Checking if PowerShell module for Active Directory is already loaded..."
$ADModuleLoaded = $null
$ADModuleLoaded = Get-Module | where {$_.Name -eq "ActiveDirectory"}
if ($ADModuleLoaded -eq $null){
Write-Host "Loading PowerShell module for Active Directory ..."
Import-Module -Name "ActiveDirectory"}
Write-Host -ForegroundColor Green "Powershell module for Active Directory is loaded."
Write-Host
$ServerList = $null
$ServerList = Get-ADComputer -Filter '(OperatingSystem -like "*Server*") -AND (Enabled -ne "False")' -Properties DNSHostName | Select-Object DNSHostName | Sort-Object DNSHostName
$IsOnline = $null
ForEach ($Server in $ServerList) {
$IsOnline = Test-Connection -ComputerName $Server.DNSHostName -BufferSize 10 -Count 1 -Quiet
if ($IsOnline -eq $true){
Write-Host -ForegroundColor Green $Server.DNSHostName "is ONLINE"
}
else {
Write-Host -ForegroundColor Red $Server.DNSHostName "is OFFLINE"
}
}
żródło
Subskrybuj:
Posty (Atom)