Active Directory と Powershell / GPO を扱うには
グループポリシーの構成
- 準備中
書籍:
- https://bookplus.nikkei.com/atcl/catalog/22/S80170/
- ひと目でわかるActive Directory Windows Server 2022版 / 日経BP
第5章 グループポリシーの構成 ; P245
コマンド:
echo "GPOを表示する" $mydomain = "FQDN of DOMAIN" Get-GPO -All -Domain $mydomain
echo "GPOのリンク先を調べる”
Get-GPOReport -Name ${GPO-Name} - ReportType HTML -Path ${Path2File}
グループポリシーでリモートデスクトップ接続ができるようにする
Miscellaneous:
- その他
/powershell/Invoke-WebRequest を使用してサーバ上のファイルの情報を取得する
- Invoke-WebRequest を使用して接続先のファイルの情報(更新日時)を取得したい
- ソース
- Miscellaneous
Invoke-WebRequest を使用して接続先のファイルの情報(更新日時)を取得したい
使用する言語は Powershell v5.1
続きを読むvmstat/ps/bash on centos 7.7
vmstat と ps の結果を紐づけ
On CentOS v7.7
下準備
- /file/ _get_ps.sh
- /file/ _get_vmstat.shy
- /file/ mystart.sh
- /file/ mystop.sh
- /file/ mymakecsv.sh
- /file/ mysqlite3.sh
- /directory/ ./results.d
- /directory/ ./sql.d/
- /file/ ./sql.d/mycreatetable01.sql
- /file/ ./sql.d/mycreatetable02.sql
- /file/ ./sql.d/base.select.sql
powershell いろいろ備忘録/ぐるぐる01
テキスト01:
cat .\abc.txt x01|a|192.168.0.1|c|d x02|b|192.168.0.2 x03|c|192.168.0.3|c|d x04|d|10.2.3.5|x|192.168.0.4 x05|e|11.23.45.67|p|192.168.0.5|d|e
ソース01
# created_on: 2019-08-03 18:37:37
# powershell -execuutionpolicy remotesigned -file get-abc.ps1
$myresult = (cat abc.txt)
foreach( $myline in $myresult){
$tmparray = @()
$mylinenumber = 0
$myipaddressnumber = 0
$tmparray = ( $myline -split "\|")
# echo $tmparray
foreach( $mycontent in $tmparray){
if($mycontent -match "192\.168"){
$myipaddressnumber = $mylinenumber
}
$mylinenumber++
}
"{0}|{1}|{2}" -f $tmparray[0],$tmparray[$myipaddressnumber-1],$tmparray[$myipaddressnumber]
}
vba/excel/ outlook の特定フォルダのメール情報を取得しテキストとして保存
Outlookの特定フォルダのメール情報を取得してテキストファイルに保存
課題は次のとおり
- メールの件名が合致しなかった場合の処理
- CommandButton2_Click() はオマケ
お借りした情報
ソース(いろいろ準備中)
Private Sub CommandButton3_Click()
Set objoutlook = New Outlook.Application
Set myNameSpace = objoutlook.GetNamespace("MAPI")
' ------------
' filesystemobject
' ------------
Set myfso = New FileSystemObject
p = 11
r = 13
For Each i In myNameSpace.Folders
For Each j In i.Folders
If j = "DIRECT" Then
Cells(11, 1) = j
Cells(11, 2) = j.Items.Count
For Each k In j.Items
'--- [ EXCEL ] ---
Cells(r, 1) = k.Subject
Cells(r, 2) = k.SenderName
Cells(r, 3) = k.SenderEmailAddress
Cells(r, 4) = Replace(k.Body, vbCrLf, "<br>")
'--- [ REG ] ---
'--- [ TEXT FILE ] ---
Set myfile = myfso.CreateTextFile("C:\path\to\" & gethostname(k.Subject) & ".txt", True, True)
'myfile.WriteLine ("===[Begin]================")
myfile.WriteLine ("subject: " & Cells(r, 1))
myfile.WriteLine ("user: " & Cells(r, 2))
myfile.WriteLine ("from_address: " & Cells(r, 3))
myfile.WriteLine ("body: " & k.Body)
'myfile.WriteLine ("===[END]================")
myfile.Close
r = r + 1
Next
End If
Next
Next
'
Set myfile = Nothing
Set myfso = Nothing
Set objoutlook = Nothing
Set myNameSpace = Nothing
End Sub
Private Sub CommandButton2_Click()
starty = 13
xstart = 1
xfin = 4
' start_cell; (y,x) = ( starty, 1)
' end___cell; (y,x) = ( cells(rows.count,1).end(xlup), xfin)
lastY = Cells(Rows.Count, 1).End(xlUp).Row
Cells(2, 3) = lastY
Range(Cells(starty, 1), Cells(lastY, xfin)).ClearContents
End Sub