get-help about_switch -examples
для действий в зависимости от расширения файла.get-help send-mailmessage -examples
для настройки отсылки сообщения. Get-ChildItem d:\test -Recurse -Filter *img_*.svg
[IO.Directory]::EnumerateFiles('d:\test\','*img_*.svg','AllDirectories')
[IO.Directory]::EnumerateFiles('d:\test\','*img_*.svg','AllDirectories') | foreach {(Get-Content $_ -raw) -replace '.png','.jpg' | Set-Content $_) }
The cmdlets for Windows Server Backup are contained in a Windows PowerShell snap-in. Before you begin, you must install the cmdlet snap-in. (For instructions, see Install Windows Server Backup Tools (go.microsoft.com/fwlink/?LinkID=101794)). Then, each time you use the cmdlets, you must add the Windows Server Backup cmdlet snap-in to the instance of Windows PowerShell that you have opened by using the following command at the command prompt: C:\PS>add-pssnapin windows.serverbackup.
get-command *feature* | sort source
get-windowsfeature
Get-WindowsFeature : Целевым объектом указанного командлета не может быть клиентская операционная система Windows..
Get-WindowsOptionalFeature -online
Get-WindowsOptionalFeature -online | Where {$_.State -eq "enabled"}
Get-WindowsOptionalFeature -online | Where {$_.FeatureName -like "*telnet*"}
Computer Configuration -> Administrative Templates -> System -> User Profiles
Delete cached copies of roaming profiles
$PSVersionTable.PSVersion
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version, Release, @{
name="Product"
expression={
switch($_.Release) {
378389 { [Version]"4.5" }
378675 { [Version]"4.5.1" }
378758 { [Version]"4.5.1" }
379893 { [Version]"4.5.2" }
393295 { [Version]"4.6" }
393297 { [Version]"4.6" }
394254 { [Version]"4.6.1" }
394271 { [Version]"4.6.1" }
}
}
}
$NetAdapter = Get-NetAdapter -Name $InetrfaceName
$NetAdapter | New-NetIPAddress -IPAddress $IP1 -PrefixLength $NewNetMask
$NetAdapter | Remove-NetIPAddress -IPAddress $IP2 -PrefixLength $NewNetMask -Confirm:$false
$NetAdapter | Set-NetRoute -NextHop $NewGateway
$NetAdapter | Set-DnsClientServerAddress -ServerAddresses $NewDNS1,$NewDNS2