LoginSignup
3
2

More than 3 years have passed since last update.

サーバーの背景画像をPowerShellで作る

Last updated at Posted at 2019-06-08

サーバーの種類×環境数で作らないといけないので、書き捨てPowerShell。

#.NETの機能を呼び出す
Add-Type -AssemblyName System.Drawing
#画像サイズ指定
$image = New-Object System.Drawing.Bitmap(1600, 900)
$g = [System.Drawing.Graphics]::FromImage($image)
#背景用ブラシ(#006400)
$bg = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(0, 100, 0)) 
#背景を塗りつぶし
$g.FillRectangle($bg, 0, 0, 1600, 900)

#文字用ブラシ(アルファ値100)
$b = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(100, 255, 255, 255))
#フォントの指定
$font = New-Object System.Drawing.Font("Yu Gothic Medium", 50) 
#左50px、上50pxに描画
$g.DrawString("検証環境 XXサーバー", $font, $b, 50, 50)

#デスクトップにPNG形式で保存
$image.Save($Home + "\Desktop\Wallpaper.png", [System.Drawing.Imaging.ImageFormat]::Png) 

完成品
Wallpaper.png

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2