Mais conteúdo relacionado Semelhante a 社内システムの移行に役立った“時間節約”方法~PowerShellとExcelを上手に使おう (20) 社内システムの移行に役立った“時間節約”方法~PowerShellとExcelを上手に使おう8. 一般的な移行プロセス
• ハードウェア設置
• 各種移行
• 動作確認テスト
• 定時監視
• トラブルシューティング
• 運用改善
• インフラ設計、構築
• ネットワーク設計、構築
• アプリケーション設定
• 物理情報
• デバイス情報 / 各種設定情報
• 社内システムの使われ方
現状調査
設計/構築/テスト
移行
運用
9. 一般的な移行プロセス
• ハードウェア設置
• 各種移行
• 動作確認テスト
• 定時監視
• トラブルシューティング
• 運用改善
• インフラ設計、構築
• ネットワーク設計、構築
• アプリケーション設定
• 物理情報
• デバイス情報 / 各種設定情報
• 社内システムの使われ方
現状調査
設計/構築/テスト
移行
運用
どうしても時間が必要!
19. Import-Excel -FullName <Excelファイル> -Sheet <シート名> | `
Foreach-Object{
if($_.FirstName -ne '')
{
Invoke-Command –Computer <PC名> –Credential <資格情報> `
-ScriptBlock { <リモート先で実行したい処理> } -AsJob
#又は
Invoke-Command –Computer <PC名> –Credential <資格情報> `
-FilePath <ローカルの.PS1ファイル名> -AsJob
}
}
25. Windows Server 2012 R2 Essentials
を使う
Users / Groups
Anywhere
Access
Shared Folders Backup
Microsoft
Online Service
Health
Monitoring
27. PowerShellを使って移行作業を行う
• Create Folder
• Copy Folders&Files
• Install Apps
• Entry/Edit Registries
• Etc
• Install Rolls
• Install Features
• Create Users / Groups
• Create Shared Folders
• Enable WSE Features
• Etc
Windows Clients
Windows Server
2012 R2 Essentials
Automation
Setting
Parallel
Setting
37. #サンプル:ネットワーク情報を取得
if($psVer -ge 4 -and $osVer -ge 6.2)
{
#Windows 8/WS2012以上、かつ、PS v4以上の場合
Get-NetIPAddress
#More Information
Get-NetIPConfiguration
Get-NetConnectionProfile
}
else
{
#Windows 7以下の場合
Get-WmiObject Win32_NetworkAdapterConfiguration
}
43. #サンプル:ネットワーク情報を取得
Get-WmiObject -Class win32_share | `
Foreach-Object{
if($_.Name -notlike "*$")
{
Get-ChildItem $_.path -Recurse | `
ForEach-Object{
$i++
$arr = $_.Name,$_.DirectoryName,$_.Length,`
$_.CreationTime,$_.LastAccessTime,`
$_.LastWriteTime, `
(Get-Acl $_.FullName).Owner, `
"=hyperlink(`"$path$i.txt`")"
$arr -join "," | Out-File –File “C:tempshare.csv”
}
}
}
45. ~100 KB ~500 KB ~1 MB ~5 MB ~10 MB ~50 MB ~100 MB ~500 MB
~1000
MB
1000 MB
~
ファイル数 8256 9060 1979 2790 238 224 42 39 67 7
0
2000
4000
6000
8000
10000
12000
ファイル サーバーのファイルサイズ数
ファイル総数
22,000
46. ~1 日 ~3 日 ~7 日 ~14 日 ~30 日 ~60 日 ~90 日 ~180 日 ~360 日 360 日~
ファイル数 3 871 89 738 133 296 331 1055 2099 17088
0
2000
4000
6000
8000
10000
12000
ファイル サーバーの最終アクセス日
ファイル総数
22,000
48. Windows Server 2012 R2
Essentials(WSE)
Users / Groups
Anywhere
Access
Shared Folders Backup
Microsoft
Online Service
Health
Monitoring
52. Import-Excel -FullName <Excelファイル> -Sheet <シート名> | `
Foreach-Object{
if($_.FirstName -ne '')
{
[string]$first = $_.FirstName
[string]$last = $_.LastName
[string]$userName = $_.UserName
[string]$groupName = $_.Group
$pwd = $_.Password | ConvertTo-SecureString -AsPlainText -Force
Add-WssUser -FirstName $first -LastName $last `
-Name $userName -Password $pwd `
-GroupName $groupName
}
}
54. • ProはWSEのドメインに参加、GPOで設定
• Home PremiumはWinRM※を用いて
レジストリをリモートで設定
• 作業は並列処理(Job)
時間短縮 ⇒ 確認作業に割り当てる
ポリシーを統一する
(出典)Windows リモート管理 (WinRM) の概要
https://technet.microsoft.com/ja-jp/library/dn265971.aspx