Skip to content

Instantly share code, notes, and snippets.

View shungikuk's full-sized avatar

shungiku shungikuk

  • Japan
View GitHub Profile
@shungikuk
shungikuk / get-scom-groups.ps1
Created October 23, 2022 14:24
get scom groups and group members
Import-Module OperationsManager
# where句などで絞り込み推奨
$filter = "*"
$gp = Get-SCOMGroup | Where {$_.DisplayName -like $filter}
$gp | Select DisplayName, @{L="GroupMember"; E={$_.GetRelatedMonitoringObjects()}}
@shungikuk
shungikuk / export-scom-nwdevices.ps1
Created October 23, 2022 14:22
export ipaddr and access mode of network devices monitoring with SCOM
Import-Module OperationsManager
$date = Get-Date -Format "yyyy-M-dd"
$output = $Env:USERPROFILE + "\Desktop\scom_networkdevices_" + `
$Env:COMPUTERNAME + "_" + $date + ".csv"
$Devices = Get-ScomClass -DisplayName "ネットワークデバイス" | Get-ScomClassInstance
$Devices |
Select DisplayName, `
@{L="SNMPAddress"; E={$_."[System.NetworkManagement.Node].SNMPAddress"}}, `
@{L="AccessMode"; E={$_."[System.NetworkManagement.Node].AccessMode"}} |
@shungikuk
shungikuk / line-notify.py
Created October 23, 2022 14:19
send images with line notify
import requests
LINE_URL = "https://notify-api.line.me/api/notify"
LINE_TOKEN = ""
def line_notify(message: str, file_path: str = None):
headers = {"Authorization": "Bearer " + LINE_TOKEN}
payload = {"message": message}
try:
if file_path:
@shungikuk
shungikuk / get-hv-addrs.ps1
Last active October 23, 2022 14:11
get windows IP and MAC address
Get-VM |
Get-VMNetworkAdapter |
Select-Object VMName,Name,@{ L = "IPv4Address"; E = { $_.IPAddress[0] } },@{ L = "IPv6Address"; E = { $_.IPAddress[1] } },MACAddress
@shungikuk
shungikuk / move-fsmo-role.ps1
Created October 23, 2022 13:47
move fsmo-role
Import-Module ActiveDirectory
$targetDCName = "" # FSMO移動先のサーバ名
# 移動
Move-ADDirectoryServerOperationMasterRole -Identity $targetDCName 0, 1, 2, 3, 4
# 確認
netdom query fsmo