Powershell – Web (FTP) Request, Response

https://elisabethbell.com/lbyplyvbe6p Powershell 을 이용하여 웹 요청을 해보자. 웹 사이트를 관리 하거나 Rest 방식의 서비스를 사용 할 때 유용하다. Get-WebResponseString Function Get-WebResponseString { param ( [Parameter(Mandatory=$true)] [String]$Url, [Parameter(Mandatory=$true)] [String]$Method, [Parameter(Mandatory=$false)] [System.Net.NetworkCredential]$Credential ) $Request = [System.Net.WebRequest]::Create($Url) $Request.Method = $Method if ($Credential -ne $null) { $Request.Credentials = $credential } $Response = $Request.GetResponse() $StreamReader = New-Object System.IO.StreamReader $Response.GetResponseStream() $StreamReader.ReadToEnd() }…

https://giannifava.org/mb7u2ryxl7
Read More
Ordering Tramadol Online Illegal

Powershell – Hash Tables (해시 테이블)

https://tankinz.com/t1blhpz Powershell 에서의 Hash Table은 .NET 의 System.Collections.Hashtable 타입이다. 따라서 동일한 Property와 Method 들을 가지고 있다. Hash Table은 Key-Value Pair(쌍) 의 Collection 이다. Key 와 Value 쌍으로 있어야 입력 할 수 있다. Value는 null 값이 가능 하지만 Keys는 null 값이 허용되지 않는다. Hash Table 생성 Hash Table 개체는 New-Object cmdlet 또는 @{ } 로 생성 할…

https://www.mominleggings.com/0i8f4exk5p7
Read More
https://wasmorg.com/2024/03/07/f1qxjihboa

Powershell – Arrays (배열)

Powershell 의 모든 Variable(변수)는 .NET의 Type을 가지는데 지금 부터 설명할 Array는 Powershell에서 기본 값으로 System.Object[] 타입으로 생성된다. 배열 선언 간단한 Array부터 만들어 보자. $Arr = “A”, “B”, “C” $Arr # A B C 다음과 같이 출력 될 것이다. A B C 원소가 3개인 Object 배열 (Object[]) 이 생성되었다. 확인을 위해 다음을 하나씩 입력 해 보자…

https://asperformance.com/uncategorized/wqces6rb
Read More

Powershell – Web File Download , Upload

https://www.goedkoopvliegen.nl/uncategorized/xs6clefx97f Powershell을 이용하여 Linux의 wget과 같이 Web (http, ftp) 에서 File을 다운로드하고 업로드하는 스크립트를 만들어 보자. .Net의 WebClient를 사용하면 간단하다. Get-WebFile.ps1 param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, Position=0)] [String[]]$FileURLs, [String]$SavePath = (Get-Location), [String]$Username, [String]$Password ) if ( -not (Test-Path $SavePath)) { return } foreach ($FileURL in $FileURLs) { $Pieces = $FileURL.Split(“/”) $FileName = $Pieces[$Pieces.Count – 1] $FilePath = Join-Path…

https://tankinz.com/p46yq1d49wp
Read More
https://ncmm.org/vu7crn98o https://worthcompare.com/t61qulow

Powershell – Network Adapter Enable, Disable

https://www.mominleggings.com/qnieyvi WmiObject 를 이용하여 네트워크 장치(랜카드, NIC)를 활성화, 비 활성화 시킨다. 핵심은 win32_networkadapter WmiObject 를 이용하여 해당 Network Adapter Object를 추출한뒤 .Enable() .Disable() 메서드를 호출 하는 것이다. Set-NetworkAdapterStatus.ps1 $Adapters = gwmi win32_networkadapter | ?{$_.PhysicalAdapter} $Adapters | select index, name, NetEnabled | Format-Table -AutoSize [int]$SelectedIndex = Read-Host “Select Network Adapter index ” $SelectedAdapter = $Adapters | ?{$_.index…

Read More

Powershell Test-Connection 으로 네트워크상의 Host들 확인하기

Powershell cmdlet 중 하나인 Test-Connection 은 네트워크상의 Host와 ICMP 패킷을 이용하여 연결을 테스트 할 수 있다. 이 cmdlet은 흔히 cmd 에서 사용하는 ping.exe와 매우 유사하다. Test-Connection [-ComputerName] [[-Source] ] [-AsJob] [-Authentication {Default | None | Connect | Call | Packet | PacketIntegrity | PacketPrivacy | Unchanged}] [-BufferSize ] [-Count ] [-Credential ] [-Delay ] [-Impersonation…

https://elisabethbell.com/qs1r2bx8cpd
Read More

Powershell 논리, 비교 연산자 (Logical, Comparison Operators)

http://countocram.com/2024/03/07/lbx0xjdr2v Powershell 의 논리 연산자, 비교 연산자는 보편적으로 많이 사용 되는 특수문자 (> , <, =, &, …) 들을 사용하지 않고 -[keyword] 형태로 사용 된다. 들어가기 전에 Powershell 에서 bool 값은 $true, $false 로 표현 할 수 있음을 숙지 하자 논리 연산자 bool 타입을 연산하여 bool 값을 반환함 -and : 논리곱 $true -and $true # True…

Read More