1707 private links
Get-WannaCryPatchState - Scans an AD domain to find all Windows Computers, try to connect to them, get the installed hotfixes and sees if one of 'KB4012212', 'KB4012213', 'KB4012214', 'KB4012215', 'KB4012216', 'KB4012217', 'KB4012598', 'KB4013429', 'KB4015217', 'KB4015438', 'KB4015549', 'KB4015550', 'KB4015551', 'KB4015552', 'KB4015553', 'KB4016635', 'KB4019215', 'KB4019216', 'KB4019264', 'KB4019472' are installed. The status of each machine is output to a log in the user's My Documents and a full summary is given at the end.
PSScriptAnalyzer est un module PowerShell qui vérifie le code de vos scripts et de vos modules pour évaluer la qualité de votre code en se basant sur un ensemble de règles de bonnes pratiques.
https://www.powershellgallery.com/packages/PSScriptAnalyzer/1.12.0
Mixer Excel avec PowerShell. /Coude.
Static
$IP = "192.168.1.101"
$Mask = 24
$Gateway = "192.168.1.1"
$DNS1 = "192.168.1.2"
$DNS2 = "80.67.169.12"
$IPType = "IPv4"
$adapter = Get-NetAdapter | ? {$_.Status -eq "up"}
If (($adapter | Get-NetIPConfiguration).IPv4Address.IPAddress) {
$adapter | Remove-NetIPAddress -AddressFamily $IPType -Confirm:$false
}
If (($adapter | Get-NetIPConfiguration).Ipv4DefaultGateway) {
$adapter | Remove-NetRoute -AddressFamily $IPType -Confirm:$false
}
$adapter | New-NetIPAddress -AddressFamily $IPType -IPAddress $IP -PrefixLength $Mask -DefaultGateway $Gateway
$adapter | Set-DnsClientServerAddress -ServerAddresses ("$DNS1","$DNS2")
DHCP
$IPType = "IPv4"
$adapter = Get-NetAdapter | ? {$_.Status -eq "up"}
$interface = $adapter | Get-NetIPInterface -AddressFamily $IPType
If ($interface.Dhcp -eq "Disabled") {
If (($interface | Get-NetIPConfiguration).Ipv4DefaultGateway) {
$interface | Remove-NetRoute -Confirm:$false
}
$interface | Set-NetIPInterface -DHCP Enabled
$interface | Set-DnsClientServerAddress -ResetServerAddresses
}
ePub + Kindle available Jan 13, 2017
Pour les scripts PS1 Powershell qui refusent de s'exécuter.