Update README.md
This commit is contained in:
		
							parent
							
								
									ff28fa6429
								
							
						
					
					
						commit
						4340cc4218
					
				
					 1 changed files with 77 additions and 71 deletions
				
			
		
							
								
								
									
										148
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										148
									
								
								README.md
									
										
									
									
									
								
							|  | @ -1063,51 +1063,53 @@ Error: 1722 - сервер rpc недоступен (ошибка отката  | ||||||
| При создании backup DC через WSB, создается копия состояния системы (System State), куда попадает база AD (NTDS.DIT), объекты групповых политик, содержимое каталога SYSVOL, реестр, метаданные IIS, база AD CS, и другие системные файлы и ресурсы. Резервная копия создается через службу теневого копирования VSS. \ | При создании backup DC через WSB, создается копия состояния системы (System State), куда попадает база AD (NTDS.DIT), объекты групповых политик, содержимое каталога SYSVOL, реестр, метаданные IIS, база AD CS, и другие системные файлы и ресурсы. Резервная копия создается через службу теневого копирования VSS. \ | ||||||
| `Get-WindowsFeature Windows-Server-Backup` проверить установлена ли роль \ | `Get-WindowsFeature Windows-Server-Backup` проверить установлена ли роль \ | ||||||
| `Add-Windowsfeature Windows-Server-Backup –Includeallsubfeature` установить роль | `Add-Windowsfeature Windows-Server-Backup –Includeallsubfeature` установить роль | ||||||
| 
 | ``` | ||||||
| `$path="\\$srv\bak-dc\dc-03\"` \ | $path="\\$srv\bak-dc\dc-03\" | ||||||
| `[string]$TargetUNC=$path+(get-date -f 'yyyy-MM-dd')` \ | [string]$TargetUNC=$path+(get-date -f 'yyyy-MM-dd') | ||||||
| `if ((Test-Path -Path $path) -eq $true) {New-Item -Path $TargetUNC -ItemType directory} # если путь доступен, создать новую директорию по дате` \ | if ((Test-Path -Path $path) -eq $true) {New-Item -Path $TargetUNC -ItemType directory} # если путь доступен, создать новую директорию по дате | ||||||
| `$WBadmin_cmd = "wbadmin.exe START BACKUP -backupTarget:$TargetUNC -systemState -noverify -vssCopy -quiet" \ | $WBadmin_cmd = "wbadmin.exe START BACKUP -backupTarget:$TargetUNC -systemState -noverify -vssCopy -quiet" | ||||||
| `# $WBadmin_cmd = "wbadmin start backup -backuptarget:$path -include:C:\Windows\NTDS\ntds.dit -quiet" # Backup DB NTDS` \ | # $WBadmin_cmd = "wbadmin start backup -backuptarget:$path -include:C:\Windows\NTDS\ntds.dit -quiet" # Backup DB NTDS | ||||||
| `Invoke-Expression $WBadmin_cmd` | Invoke-Expression $WBadmin_cmd | ||||||
| 
 | ``` | ||||||
| ### DNS | ### DNS | ||||||
| `$zone = icm $srv {Get-DnsServerZone} | select ZoneName,ZoneType,DynamicUpdate,ReplicationScope,SecureSecondaries,` \ | ``` | ||||||
| `DirectoryPartitionName | Out-GridView -Title "DNS Server: $srv" –PassThru` \ | $zone = icm $srv {Get-DnsServerZone} | select ZoneName,ZoneType,DynamicUpdate,ReplicationScope,SecureSecondaries, | ||||||
| `$zone_name = $zone.ZoneName` \ | DirectoryPartitionName | Out-GridView -Title "DNS Server: $srv" –PassThru | ||||||
| `if ($zone_name -ne $null) {` \ | $zone_name = $zone.ZoneName | ||||||
| `icm $srv {Get-DnsServerResourceRecord -ZoneName $using:zone_name | sort RecordType | select RecordType,HostName, @{` \ | if ($zone_name -ne $null) { | ||||||
| `Label="IPAddress"; Expression={$_.RecordData.IPv4Address.IPAddressToString}},TimeToLive,Timestamp` \ | icm $srv {Get-DnsServerResourceRecord -ZoneName $using:zone_name | sort RecordType | select RecordType,HostName, @{ | ||||||
| `} | select RecordType,HostName,IPAddress,TimeToLive,Timestamp | Out-GridView -Title "DNS Server: $srv"` \ | Label="IPAddress"; Expression={$_.RecordData.IPv4Address.IPAddressToString}},TimeToLive,Timestamp | ||||||
| `}` | } | select RecordType,HostName,IPAddress,TimeToLive,Timestamp | Out-GridView -Title "DNS Server: $srv" | ||||||
| 
 | } | ||||||
|  | ``` | ||||||
| `Sync-DnsServerZone –passthru` синхронизировать зоны с другими DC в домене \ | `Sync-DnsServerZone –passthru` синхронизировать зоны с другими DC в домене \ | ||||||
| `Remove-DnsServerZone -Name domain.local` удалить зону \ | `Remove-DnsServerZone -Name domain.local` удалить зону \ | ||||||
| `Get-DnsServerResourceRecord -ZoneName domain.local -RRType A` вывести все А-записи в указанной зоне \ | `Get-DnsServerResourceRecord -ZoneName domain.local -RRType A` вывести все А-записи в указанной зоне \ | ||||||
| `Add-DnsServerResourceRecordA -Name new-host-name -IPv4Address 192.168.1.100 -ZoneName domain.local -TimeToLive 01:00:00 -CreatePtr` создать А-запись и PTR для нее \ | `Add-DnsServerResourceRecordA -Name new-host-name -IPv4Address 192.168.1.100 -ZoneName domain.local -TimeToLive 01:00:00 -CreatePtr` создать А-запись и PTR для нее \ | ||||||
| `Remove-DnsServerResourceRecord -ZoneName domain.local -RRType A -Name new-host-name –Force` удалить А-запись | `Remove-DnsServerResourceRecord -ZoneName domain.local -RRType A -Name new-host-name –Force` удалить А-запись | ||||||
| 
 | ``` | ||||||
| `$DNSServer = "DC-01" \` \ | $DNSServer = "DC-01" | ||||||
| `$DNSFZone = "domain.com"` \ | $DNSFZone = "domain.com" | ||||||
| `$DataFile = "C:\Scripts\DNS-Create-A-Records-from-File.csv"` \ | $DataFile = "C:\Scripts\DNS-Create-A-Records-from-File.csv" | ||||||
| `# cat $DataFile` \ | # cat $DataFile | ||||||
| `# "HostName;IP"` \ | # "HostName;IP" | ||||||
| `# "server-01;192.168.1.10"` \ | # "server-01;192.168.1.10" | ||||||
| `$DNSRR = [WmiClass]"\\$DNSServer\root\MicrosoftDNS:MicrosoftDNS_ResourceRecord"` \ | $DNSRR = [WmiClass]"\\$DNSServer\root\MicrosoftDNS:MicrosoftDNS_ResourceRecord" | ||||||
| `$ConvFile = $DataFile + "_unicode"` \ | $ConvFile = $DataFile + "_unicode" | ||||||
| `Get-Content $DataFile | Set-Content $ConvFile -Encoding Unicode` \ | Get-Content $DataFile | Set-Content $ConvFile -Encoding Unicode | ||||||
| `Import-CSV $ConvFile -Delimiter ";" | ForEach-Object {` \ | Import-CSV $ConvFile -Delimiter ";" | ForEach-Object { | ||||||
| `$FQDN = $_.HostName + "." + $DNSFZone` \ | $FQDN = $_.HostName + "." + $DNSFZone | ||||||
| `$IP = $_.HostIP` \ | $IP = $_.HostIP | ||||||
| `$TextA = "$FQDN IN A $IP"` \ | $TextA = "$FQDN IN A $IP" | ||||||
| `[Void]$DNSRR.CreateInstanceFromTextRepresentation($DNSServer,$DNSFZone,$TextA)` \ | [Void]$DNSRR.CreateInstanceFromTextRepresentation($DNSServer,$DNSFZone,$TextA) | ||||||
| `}` | } | ||||||
| 
 | ``` | ||||||
| ### DHCP | ### DHCP | ||||||
| `$mac = icm $srv -ScriptBlock {Get-DhcpServerv4Scope | Get-DhcpServerv4Lease} | select AddressState,` \ | ``` | ||||||
| `HostName,IPAddress,ClientId,DnsRegistration,DnsRR,ScopeId,ServerIP | Out-GridView -Title "HDCP Server: $srv" –PassThru` \ | $mac = icm $srv -ScriptBlock {Get-DhcpServerv4Scope | Get-DhcpServerv4Lease} | select AddressState, | ||||||
| `(New-Object -ComObject Wscript.Shell).Popup($mac.ClientId,0,$mac.HostName,64)` | HostName,IPAddress,ClientId,DnsRegistration,DnsRR,ScopeId,ServerIP | Out-GridView -Title "HDCP Server: $srv" –PassThru | ||||||
| 
 | (New-Object -ComObject Wscript.Shell).Popup($mac.ClientId,0,$mac.HostName,64) | ||||||
|  | ``` | ||||||
| `Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.10 -ClientId 00-50-56-C0-00-08 -Description "new reservation"` | `Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.10 -ClientId 00-50-56-C0-00-08 -Description "new reservation"` | ||||||
| 
 | 
 | ||||||
| ### RDS | ### RDS | ||||||
|  | @ -1719,16 +1721,16 @@ CopyQueue Length - длина репликационной очереди коп | ||||||
| `$pars.Links | fl title,innerText,href` \ | `$pars.Links | fl title,innerText,href` \ | ||||||
| `$pars.Images.src` links on images \ | `$pars.Images.src` links on images \ | ||||||
| `iwr $url -OutFile $path` download | `iwr $url -OutFile $path` download | ||||||
| 
 | ``` | ||||||
| `$pars = wget -Uri $url` \ | $pars = wget -Uri $url | ||||||
| `$pars.Images.src | %{` \ | $pars.Images.src | %{ | ||||||
| `$name = $_ -replace ".+(?<=/)"` \ | $name = $_ -replace ".+(?<=/)" | ||||||
| `wget $_ -OutFile "$home\Pictures\$name"` \ | wget $_ -OutFile "$home\Pictures\$name" | ||||||
| `}` \ | } | ||||||
| `$count_all = $pars.Images.src.Count` \ | $count_all = $pars.Images.src.Count | ||||||
| `$count_down = (Get-Item $path\*).count` \ | $count_down = (Get-Item $path\*).count | ||||||
| `"Downloaded $count_down of $count_all files to $path"` | "Downloaded $count_down of $count_all files to $path" | ||||||
| 
 | ``` | ||||||
| Methods: \ | Methods: \ | ||||||
| GET - Read \ | GET - Read \ | ||||||
| POST - Create \ | POST - Create \ | ||||||
|  | @ -1736,31 +1738,35 @@ PATCH - Partial update/modify \ | ||||||
| PUT - Update/replace \ | PUT - Update/replace \ | ||||||
| DELETE - Remove | DELETE - Remove | ||||||
| 
 | 
 | ||||||
| `https://veeam-11:9419/swagger/ui/index.html` \ | ### Token | ||||||
| `$Header = @{` \ | ``` | ||||||
| `"x-api-version" = "1.0-rev2"` \ | https://veeam-11:9419/swagger/ui/index.html | ||||||
| `}` \ | $Header = @{ | ||||||
| `$Body = @{` \ | "x-api-version" = "1.0-rev2" | ||||||
| `"grant_type" = "password"` \ | } | ||||||
| `"username" = "$login"` \ | $Body = @{ | ||||||
| `"password" = "$password"` \ | "grant_type" = "password" | ||||||
| `}` \ | "username" = "$login" | ||||||
| `$vpost = iwr "https://veeam-11:9419/api/oauth2/token" -Method POST -Headers $Header -Body $Body -SkipCertificateCheck` \ | "password" = "$password" | ||||||
| `$vtoken = (($vpost.Content) -split '"')[3]` | } | ||||||
|  | $vpost = iwr "https://veeam-11:9419/api/oauth2/token" -Method POST -Headers $Header -Body $Body -SkipCertificateCheck | ||||||
|  | $vtoken = (($vpost.Content) -split '"')[3] | ||||||
|  | ``` | ||||||
|  | ### GET | ||||||
|  | ``` | ||||||
|  | $token = $vtoken | ConvertTo-SecureString -AsPlainText –Force | ||||||
|  | $vjob = iwr "https://veeam-11:9419/api/v1/jobs" -Method GET -Headers $Header -Authentication Bearer -Token $token -SkipCertificateCheck | ||||||
| 
 | 
 | ||||||
| `$token = $vtoken | ConvertTo-SecureString -AsPlainText –Force` \ | $Header = @{ | ||||||
| `$vjob = iwr "https://veeam-11:9419/api/v1/jobs" -Method GET -Headers $Header -Authentication Bearer -Token $token -SkipCertificateCheck` | "x-api-version" = "1.0-rev1" | ||||||
| 
 | "Authorization" = "Bearer $vtoken" | ||||||
| `$Header = @{` \ | } | ||||||
| `"x-api-version" = "1.0-rev1"` \ | $vjob = iwr "https://veeam-11:9419/api/v1/jobs" -Method GET -Headers $Header -SkipCertificateCheck | ||||||
| `"Authorization" = "Bearer $vtoken"` \ | $vjob = $vjob.Content | ConvertFrom-Json | ||||||
| `}` \ |  | ||||||
| `$vjob = iwr "https://veeam-11:9419/api/v1/jobs" -Method GET -Headers $Header -SkipCertificateCheck` \ |  | ||||||
| `$vjob = $vjob.Content | ConvertFrom-Json` |  | ||||||
| 
 |  | ||||||
| `$vjob = Invoke-RestMethod "https://veeam-11:9419/api/v1/jobs" -Method GET -Headers $Header -SkipCertificateCheck` \ |  | ||||||
| `$vjob.data.virtualMachines.includes.inventoryObject` |  | ||||||
| 
 | 
 | ||||||
|  | $vjob = Invoke-RestMethod "https://veeam-11:9419/api/v1/jobs" -Method GET -Headers $Header -SkipCertificateCheck | ||||||
|  | $vjob.data.virtualMachines.includes.inventoryObject | ||||||
|  | ``` | ||||||
| # IE | # IE | ||||||
| 
 | 
 | ||||||
| `$ie.document.IHTMLDocument3_getElementsByTagName("input")  | select name` получить имена всех Input Box \ | `$ie.document.IHTMLDocument3_getElementsByTagName("input")  | select name` получить имена всех Input Box \ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue