microsoft/windows
microsoft/powershell
powershell
download file
Invoke-WebRequest -uri 'https://github.com/microsoft/windows-container-tools/releases/download/v1.1/LogMonitor.exe' -OutFile 'c:\Logmonitor.exe'
Invoke-WebRequest -uri 'https://github.com/prometheus-community/windows_exporter/releases/download/v0.25.1/windows_exporter-0.25.1-amd64.msi' -OutFile 'c:\windows_exporter-0.25.1-amd64.msi'
msiexec / i 'c:\windows_exporter-0.25.1-amd64.msi' ENABLED_COLLECTORS = os , iis
# default port 9182
Invoke-WebRequest -URI 'http://localhost:9182/metrics' -UseBasicParsing
download-AWSNVMe.zip-
invoke-webrequest https://s3.amazonaws.com/ec2-windows-drivers-downloads/NVMe/Latest/AWSNVMe.zip -outfile $env :USERPROFILE\n vme_driver.zip
expand-archive $env :userprofile\n vme_driver.zip -DestinationPath $env :userprofile\n vme_driver
download file using base64
tar folder, do not zip it
function ConvertTo-Base64 ( $file_path ) {
$content = Get-Content -Path $file_path -Raw
$byte_array = [System.Text.Encoding] :: UTF8 . GetBytes ( $content )
$base64 = [System.Convert] :: ToBase64String ( $byte_array )
return $base64
}
# 指定要转换为Base64的文件路径
$file_path = "C:\path\to\your\file.txt"
# 调用函数将文件内容转换为Base64编码
$base64_content = ConvertTo-Base64 -file_path $file_path
# 打印Base64编码后的内容
Write-Host $base64_content
connecting-to-sql-server-using-dotnet-framework-
$sqlConn = New-Object System . Data . SqlClient . SqlConnection
$sqlConn . ConnectionString = "Server=xxx.us-east-1.rds.amazonaws.com;Integrated Security=true;Initial Catalog=master"
$sqlConn . Open ()
echo $SqlConn
$sqlCmd = $sqlConn . CreateCommand ()
$sqlCmd . CommandText = "select session_id,client_net_address from sys.dm_exec_connections"
$sqlAdapter = New-Object System . Data . SqlClient . SqlDataAdapter
$sqlAdapter . SelectCommand = $sqlCmd
$dataSet = New-Object System . Data . DataSet
$sqlAdapter . Fill ( $dataSet )
$dataSet . Tables [ 0 ] | Format-Table
StatisticsEnabled : False
AccessToken :
ConnectionString : Server=xxx.com;Integrated Security=true;Initial Catalog=master
ConnectionTimeout : 15
Database : master
DataSource : xxx.us-east-1.rds.amazonaws.com
PacketSize : 8000
ClientConnectionId : 02f6f78e-0c5c-4400-9506-2ff19679e978
ServerVersion : 15.00.4355
State : Open
WorkstationId : 11C683A04E28
Credential :
FireInfoMessageEventOnUserErrors : False
Site :
Container :