coexistence-configuration の PSsnap-in を追加すると何ができるようになるのか
PowerShell から手動で Office 365 とディレクトリ同期を行うときに Add-PSsnapin coexistence-configuration
を実行してから Start-OnlineCoexistenceSync
を実行するというのは検索すればすぐに出てくるので新しい話ではないのですが、ちょっと待て、と。よく考えてみると Start-OnlineCoexistenceSync
だけを実行するために PSsnap-in を落としてくるのはちょっと非効率すぎないかと思って、中身を見てみました。
Get-Command -Module Coexistence-Configuration | ft CommandType,Name -AutoSize CommandType Name ----------- ---- Cmdlet Disable-DirSyncLog Cmdlet Disable-MSOnlinePasswordSync Cmdlet Disable-MSOnlineRichCoexistence Cmdlet Disable-PasswordSyncLog Cmdlet Enable-DirSyncLog Cmdlet Enable-MSOnlinePasswordSync Cmdlet Enable-MSOnlineRichCoexistence Cmdlet Enable-PasswordSyncLog Cmdlet Get-CoexistenceConfiguration Cmdlet Get-DirSyncLogStatus Cmdlet Get-PasswordSyncLogStatus Cmdlet Set-CoexistenceConfiguration Cmdlet Set-CompanyDirSyncFeatures Cmdlet Set-FullPasswordSync Cmdlet Start-OnlineCoexistenceSync Cmdlet Update-MSOLDirSyncNetworkProxySetting
他にもたくさんありますねw
上で列挙されたコマンドの名前を見るとだいたい何をするためのコマンドかわかりますが、coexistence-configuration
スナップインを追加することで Windows Azure Active Directory ディレクトリ同期ツールの構成ウィザードで設定する内容を PowerShell で実行するための(本当はツールが裏で PS を実行しているだけだと思いますが)コマンド各種が実行可能になるようです。詳細は後述で Get-Help -Detailed
した内容を貼付けておくので興味があれば見てみてください(ところでこれらのコマンドがなぜ公式で一切情報提供されてないんでしょうか…)。
Enable-MSOnlineRichCoexistence
って何かと思ったのですがおそらく構成ウィザードにおける [混合環境を有効にする] で、Azure -> On-Premise の方向での同期の権限付与とかそういう動作のためのコマンドみたいです。
あと、Update-MSOLDirSyncNetworkProxySetting
は Error message when you run the Directory Sync tool Configuration Wizard: "Your credentials could not be authenticated" という KB が出ていることから察するに、構成ウィザードでは WinHTTP のプロキシの設定を拾ってくれる一方 PowerShell の場合は明示的にこのコマンドでプロキシの設定を拾わないとだめな感じでしょうか。
名前 Disable-DirSyncLog 概要 This commandlet is used to disable logging for the Azure Active Directory Sync tool. 構文 Disable-DirSyncLog [<CommonParameters>] 説明 This commandlet is used to disable logging for the Azure Active Directory Sync tool. パラメーター <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Example -------------- C:\PS>Disable-DirSyncLog 注釈 例を参照するには、次のように入力してください: "get-help Disable-DirSyncLog -examples". 詳細を参照するには、次のように入力してください: "get-help Disable-DirSyncLog -detailed". 技術情報を参照するには、次のように入力してください: "get-help Disable-DirSyncLog -full". 名前 Disable-MSOnlinePasswordSync 構文 Disable-MSOnlinePasswordSync -Credential <pscredential> [-WhatIf] [-Confirm] [<CommonParameters>] パラメーター -Confirm -Credential <pscredential> -WhatIf <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 エイリアス なし 注釈 なし 名前 Disable-MSOnlineRichCoexistence 構文 Disable-MSOnlineRichCoexistence -Credential <pscredential> [-WhatIf] [-Confirm] [<CommonParameters>] パラメーター -Confirm -Credential <pscredential> -WhatIf <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 エイリアス なし 注釈 なし 名前 Disable-PasswordSyncLog 概要 This commandlet is used to disable logging for the Password Sync feature of the Azure Active Directory Sync tool. 構文 Disable-PasswordSyncLog [<CommonParameters>] 説明 This commandlet is used to disable logging for the Password Sync feature of the Azure Active Directory Sync tool. パラメーター <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Example -------------- C:\PS>Disable-PasswordSyncLog 注釈 例を参照するには、次のように入力してください: "get-help Disable-PasswordSyncLog -examples". 詳細を参照するには、次のように入力してください: "get-help Disable-PasswordSyncLog -detailed". 技術情報を参照するには、次のように入力してください: "get-help Disable-PasswordSyncLog -full". 名前 Enable-DirSyncLog 概要 This commandlet is used to configure the logging level for the Azure Active Directory Sync tool. 構文 Enable-DirSyncLog [-FilePath <String>] [-TraceLevel <String>] [<CommonParameters>] 説明 This commandlet is used to configure the logging level for the Azure Active Directory Sync tool. パラメーター -FilePath <String> Specifies the location in the files system where the log file should be written to. If not speci fied, defaults to the location where the Directory Sync tool is installed. -TraceLevel <String> Specifies the level to configure the Directory Sync tool to log at. Valid options are: “Error”, “Warning”, “Info”, “Verbose”. If not specified, defaults to “Verbose”. <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Example -------------- C:\PS>Enable-DirSyncLog -TraceLevel Info -FilePath C:\DirSync.log 注釈 例を参照するには、次のように入力してください: "get-help Enable-DirSyncLog -examples". 詳細を参照するには、次のように入力してください: "get-help Enable-DirSyncLog -detailed". 技術情報を参照するには、次のように入力してください: "get-help Enable-DirSyncLog -full". 名前 Enable-MSOnlinePasswordSync 構文 Enable-MSOnlinePasswordSync -Credential <pscredential> [-WhatIf] [-Confirm] [<CommonParameters>] パラメーター -Confirm -Credential <pscredential> -WhatIf <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 エイリアス なし 注釈 なし 名前 Enable-MSOnlineRichCoexistence 構文 Enable-MSOnlineRichCoexistence -Credential <pscredential> [-WhatIf] [-Confirm] [<CommonParameters>] パラメーター -Confirm -Credential <pscredential> -WhatIf <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 エイリアス なし 注釈 なし 名前 Enable-PasswordSyncLog 概要 This commandlet is used to configure the logging level for the Password Sync feature of the Azure Active Directory Sync tool. 構文 Enable-PasswordSyncLog [-FilePath <String>] [-TraceLevel <String>] [<CommonParameters>] 説明 This commandlet is used to configure the logging level for the Password Sync feature of the Azure Active Directory Sync tool. パラメーター -FilePath <String> Specifies the location in the files system where the log file should be written to. If not speci fied, defaults to the location where the Directory Sync tool is installed. -TraceLevel <String> Specifies the level to configure the Directory Sync tool to log at. Valid options are: “Error”, “Warning”, “Info”, “Verbose”. If not specified, defaults to 'Verbose'. <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Example -------------- C:\PS>Enable-PasswordSyncLog -TraceLevel Info -FilePath C:\PasswordSync.log 注釈 例を参照するには、次のように入力してください: "get-help Enable-PasswordSyncLog -examples". 詳細を参照するには、次のように入力してください: "get-help Enable-PasswordSyncLog -detailed". 技術情報を参照するには、次のように入力してください: "get-help Enable-PasswordSyncLog -full". 名前 Get-CoexistenceConfiguration 概要 Gets a configuration information from the Microsoft Online Coexistence Web Server 構文 Get-CoexistenceConfiguration -TargetCredentials <PSCredential> [<CommonParameters>] 説明 Gets a configuration information from the Microsoft Online Coexistence Web Server パラメーター -TargetCredentials <PSCredential> Administrative credentials for a company in Microsoft Online. <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Get Configuration -------------- C:\PS>$cnfg = Get-CoexistenceConfiguration Gets a configuration object from the Microsoft Online Web Service 注釈 例を参照するには、次のように入力してください: "get-help Get-CoexistenceConfiguration -examples". 詳細を参照するには、次のように入力してください: "get-help Get-CoexistenceConfiguration -detailed". 技術情報を参照するには、次のように入力してください: "get-help Get-CoexistenceConfiguration -full". 名前 Get-DirSyncLogStatus 概要 This commandlet is used to retrieve the current logging level for the Azure Active Directory Sync tool. 構文 Get-DirSyncLogStatus [<CommonParameters>] 説明 This commandlet is used to retrieve the current logging level for the Azure Active Directory Sync tool. パラメーター <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Example -------------- C:\PS>Get-DirSyncLogStatus 注釈 例を参照するには、次のように入力してください: "get-help Get-DirSyncLogStatus -examples". 詳細を参照するには、次のように入力してください: "get-help Get-DirSyncLogStatus -detailed". 技術情報を参照するには、次のように入力してください: "get-help Get-DirSyncLogStatus -full". 名前 Get-PasswordSyncLogStatus 概要 This commandlet is used to retrieve the current logging level for the Password Sync feature of the Azure Active Directory Sync tool. 構文 Get-PasswordSyncLogStatus [<CommonParameters>] 説明 This commandlet is used to retrieve the current logging level for the Password Sync feature of the Azure Active Directory Sync tool. パラメーター <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Example -------------- C:\PS>Get-PasswordSyncLogStatus 注釈 例を参照するには、次のように入力してください: "get-help Get-PasswordSyncLogStatus -examples". 詳細を参照するには、次のように入力してください: "get-help Get-PasswordSyncLogStatus -detailed". 技術情報を参照するには、次のように入力してください: "get-help Get-PasswordSyncLogStatus -full". 名前 Set-CoexistenceConfiguration 概要 Configures Microsoft Online Directory Synchronization Tool. 構文 Set-CoexistenceConfiguration -SourceCredentials <PSCredential> -TargetCredentials <PSCredential> [-Config] <CoexistenceConfiguration> [-Path <String>] [-WhatIf] [-Confirm] [<CommonParameters>] 説明 Configures Microsoft Online Directory Synchronization Tool. パラメーター -SourceCredentials <PSCredential> Enterprise Admin credentials for the forest that will be sent up to Microsoft Online. These credentials are used to create an account in Active Directory that has the minimum required permissions to read from Active Directory. -TargetCredentials <PSCredential> Administrative credentials for a company in Microsoft Online. -Config <CoexistenceConfiguration> Configuration object returned from Get-CoexistenceConfiguration -Path <String> The directory which contains XML that defines the default management agents and the metaverse schema. -WhatIf -Confirm <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Configuration -------------- C:\PS>$cnfg = Get-CoexistenceConfiguration Set-CoexistenceConfiguration $cnfg Configures Microsoft Online Directory Synchronization. 注釈 例を参照するには、次のように入力してください: "get-help Set-CoexistenceConfiguration -examples". 詳細を参照するには、次のように入力してください: "get-help Set-CoexistenceConfiguration -detailed". 技術情報を参照するには、次のように入力してください: "get-help Set-CoexistenceConfiguration -full". 名前 Set-CompanyDirSyncFeatures 構文 Set-CompanyDirSyncFeatures -TargetCredentials <pscredential> -FeaturesFlag <int> [<CommonParameters> ] パラメーター -FeaturesFlag <int> -TargetCredentials <pscredential> <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 エイリアス なし 注釈 なし 名前 Set-FullPasswordSync 概要 Resets the password sync state information forcing a full sync the next time the service is restarted. 構文 Set-FullPasswordSync [<CommonParameters>] 説明 Resets the password sync state information forcing a full sync the next time the service is restarted. パラメーター <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Set FullPasswordSync -------------- C:\PS>Set-FullPasswordSync Resets the password sync state information forcing a full sync the next time the service is restarted. 注釈 例を参照するには、次のように入力してください: "get-help Set-FullPasswordSync -examples". 詳細を参照するには、次のように入力してください: "get-help Set-FullPasswordSync -detailed". 技術情報を参照するには、次のように入力してください: "get-help Set-FullPasswordSync -full". 名前 Start-OnlineCoexistenceSync 概要 Starts synchronization with Microsoft Online 構文 Start-OnlineCoexistenceSync [-FullSync] [-WhatIf] [-Confirm] [<CommonParameters>] 説明 Starts synchronization with Microsoft Online パラメーター -FullSync Performs a full sync with Microsoft Online. -WhatIf -Confirm <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- Start Sync -------------- C:\PS>Start-OnlineCoexistenceSync Starts a directory sync with Microsoft Online. ----------- Start Full Sync ------------ C:\PS>Start-OnlineCoexistenceSync -FullSync Performs a full sync with Microsoft Online. 注釈 例を参照するには、次のように入力してください: "get-help Start-OnlineCoexistenceSync -examples". 詳細を参照するには、次のように入力してください: "get-help Start-OnlineCoexistenceSync -detailed". 技術情報を参照するには、次のように入力してください: "get-help Start-OnlineCoexistenceSync -full". 名前 Update-MSOLDirSyncNetworkProxySetting 概要 Updates the directory sync service to use the current user's http proxy settings. 構文 Update-MSOLDirSyncNetworkProxySetting [[-NoProxyUpdate]] [-WhatIf] [-Confirm] [<CommonParameters>] 説明 Copies the current user's http proxy settings off to a .config file. The directory sync will apply these settings each time it communicates with the directory sync web service パラメーター -NoProxyUpdate Causes directory sync to ignore the http proxy settings that were saved in a .config file. -WhatIf -Confirm <CommonParameters> このコマンドレットは、次の共通パラメーターをサポートします: Verbose、 Debug、ErrorAction、ErrorVariable、WarningAction、WarningVariable、 OutBuffer、および OutVariable。詳細については、about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216) を参照してください。 -------------- EXAMPLE 1 -------------- C:\PS>Update-MSOLDirSyncNetworkProxySetting Updates the http proxy settings that directory sync will use -------------- EXAMPLE 2 -------------- C:\PS>Update-MSOLDirSyncNetworkProxySetting -NoProxyUpdate Disables the automatic application of current user setting to the directory sync service. 注釈 例を参照するには、次のように入力してください: "get-help Update-MSOLDirSyncNetworkProxySetting -examples". 詳細を参照するには、次のように入力してください: "get-help Update-MSOLDirSyncNetworkProxySetting -detailed". 技術情報を参照するには、次のように入力してください: "get-help Update-MSOLDirSyncNetworkProxySetting -full". オンライン ヘルプを参照するには、次のように入力してください: "get-help Update-MSOLDirSyncNetworkProxySetting -online"
PowerShell によるパスワードの生成に char 型を使ってみる
ちょっと Active Directory でユーザーを自動的に作成する際に予めランダムかつある程度の複雑性があるパスワードを設定しておきたいなということで、これを生成する方法が必要になりました。それで、私はゆとり PowerShell-er なのでまず検索してみますと powershell.com にこんなスクリプトがありました。
function Get-RandomPassword { param( $length = 10, $characters = 'abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789!"§\$%&/()=?*+#_' ) $random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length } # output random pwd $private:ofs="" [String]$characters[$random] }
文字列の生成方法としては、予め候補となる文字記号数字を $characters
に格納し、$length
で文字数を指定して Get-Randam
でそれらの情報を利用して文字列をランダムに生成している感じで特別変わったことはしてない感じです。不足があれば記号とか増やしてあげるといいです。
次はこちら。これは Windows Server 2012 Automation with PowerShell Cookbook の Chapter 2, Creating AD Users に書かれていたスクリプトです。上述のスクリプトに対してこちらのスクリプトの書き方がちょっとおもしろいというか、理屈を考えれば何ら不思議のない書き方なのですが、あんまり見たことがない書き方かなということでこちらが本題(?)です。
function Get-RandomPass{ $newPass = '' 1..10 | ForEach-Object { $newPass += [char](Get-Random -Minimum 48 -Maximum 122) } return $newPass }
$newPass
の部分を見ると [char](Get-random -Minimun 48 -Maximum 122)
という部分があります。ここで何をしているかというと Get-Random
の -Minimum
および -Maximum
パラメータで指定した範囲内でランダムに取得された int 型の値を10進法の ASCII コードとして扱うべく [char]
で char 型に変換した結果として文字を取得しています。
上のスクリプトで指定している最小値および最大値から判断する限り、以下の文字の中からランダムに文字列を生成することが意図されていると考えられますが、この理屈から言うと ASCII 33 (min) - 126 (max) までが範囲として最大となり、最も多くの記号を利用することになります1。ASCII 32 まで含むとスペースを含むことになりますね。
$characters = '0123456789:;<=>?@ABCDEFHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz'
どちらの方法がどうだとかいうことではありませんが、fizzbuzz にもいろいろな書き方があるような感じで「へぇ」ぐらいに受け取ってもらえれば。
Get-HofixのInstalledOnの時間が取得できない(未解決)
タイトルの通りなのですが…。
PS >Get-HotFix | Format-Table -AutoSize
Source Description HotFixID InstalledBy InstalledOn
------ ----------- -------- ----------- -----------
TESTLAB01 Update KB2871777 NT AUTHORITY\SYSTEM 3/1/2014 12:00:00 AM
TESTLAB01 Update KB2877213 NT AUTHORITY\SYSTEM 3/1/2014 12:00:00 AM
TESTLAB01 Update KB2891804 NT AUTHORITY\SYSTEM 3/1/2014 12:00:00 AM
TESTLAB01 Update KB2904266 NT AUTHORITY\SYSTEM 3/1/2014 12:00:00 AM
Get-Hotfix
でインストールした Hotfix の情報を取得すると InstalledOn
のパラメータの時刻の値が勝手に 12:00:00 AM になってしまいます。それで調べてみたところ同じような現象が発生している方がいらっしゃったようでフォーラムに書き込みがされているのをいくつか見ていたところ、Microsoft Connect で報告されている以下のバグのような気がしますが、まだ fix されていないという認識でいいのでしょうかね…。
Get-Hotfix show date only if date parsing has same rules as in en-US Culture.
work around として一応 $env:windir\WindowsUpdate.log
の文字列を Select-String
して Hotfix の情報を取る方法とかあるみたいですが微妙な感じです…。
8 Faces Issue #7 と Helvetica
もう昨年末の話になるのですが、11月頃?に発行された 8 Faces Issue #7 で最初にインタビュー記事が掲載されている Michael Bierut 氏の Helvetica に関する発言の中で、最後に氏が選んだ8つのタイプフェイスのうちの1つ、Helvetica の部分に書かれているコメントが以下の通りとなるのですが、少しおもしろいなと思うところがありまして。
Because I'm in the documentary about it, people tend to associate me with Helvetica. YET I'VE ALWAYS TRIED TO RESIST IT, WHICH IS DIFFICULT. Like others, I've tried to improve it, but that's difficult too. For our wayfinding for the New York City Department of Transportation, we changed all the square dots to round, which I enjoyed. (p.16)
Michael Bierut 氏と Helvetica と言えば、まさに Helvetica というタイトルのドキュメンタリー映画に出演し非常に印象的な以下の発言をしていましたが、このドキュメンタリー映画には氏以外にも様々なタイプデザイナーの方が出演されており、それぞれが各々の観点で Helvetica について話していたことがこのドキュメンタリー映画の大きな特徴と言えると思います(今更な話ではありますが)。
一方で "people tend to associate me with Helvetica." というようなことを他のタイプデザイナーが言っているを聞いた/見たことは寡聞にしてありません(どなたかそういう発言をされているソースとかお持ちでしょうか)。
"Can you imagine how bracing and thrilling that was? That must have felt like you had crawled through a desert with your mouth caked with filthy dust, and then someone offers you a clear, refreshing distilled icy glass of water … it must have just been fantastic."
Issue #7 が発行された 2013 年当時 Helvetica に関して話題になっていたのは iOS 7 が Helvetica Neue Ultra Light を採用したとかそういうことぐらいで、今更と言っては語弊がありますが Helvetica について現在進行形で Helvetica があふれる世の中に抵抗してみたとか Helvetica をよりよくしようとしたというようなことを語るタイプデザイナーをあまり見かけない気がして、逆に新鮮な感じでした。そういう所がおもしろかったよ、という話です。
もちろん iOS 7 で Helvetica Neue Ultra Light を採用するのは適切ではなかったというような話はありましたが、それはタイプフェイスそのものの話ではないので…。
あと、どうでもいいことなのですが Helvetica の特徴について、おそらく Wikipedia からの引用だと思われるのですが”簡素な”という形容詞を使われる方をたまに見かけます。しかしながら Helvetica を表すのに簡素というのはあまり適切ではないように思います。感覚の問題と言ってしまえばそうかもしれませんが、いったいどの辺りが簡素なのか、じゃあ例えば Frutiger はどうなのか。。。
Azure ストレージ アカウントを作成するときにちょっとハマった
Windows Azure で Azure ストレージを利用する場合、ストレージ アカウントを作成する必要がありますが、Windows Azure PowerShell も公開されていることですし、Web 上のポータル サイトで GUI をポチポチせずとも常に起動しっぱなしの PowerShell でサッと作ってしまおうと思うわけです。こんな風に。
PS > New-AzureStorageAccount -StorageAccountName "azureStorage1" -Label "Storage Account for SQL" -Location "North Central US"
すると、こんなエラーが出ます。
New-AzureStorageAccount : 指定された引数は、有効な値の範囲内にありません。
パラメーター名: parameters.ServiceName
発生場所 行:1 文字:1
+ New-AzureStorageAccount `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureStorageAccount], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : System.ArgumentOutOfRangeException,Microsoft.WindowsAzure.Commands.ServiceManagement.Storage
Services.NewAzureStorageAccountCommand
最初は有効な値の範囲内とか何事かと思ったのですが、ちゃんと New-AzureStorageAccount
に関する公式サイトと Windows Azure の Web 上の GUI、そして PowerShell の Get-Help New-AzureStorageAccount -Detailed
には書いてあります(-Detailed
パラメーターがない場合はフィールドの文字入力制限について言及されている文章は出てきません)。
フィールドは 3 ~ 24 文字で指定する必要があります。 フィールドに使用できるのは、小文字のアルファベットおよび数字のみです。 (The storage account name (...) must be between 3 and 24 characters in length and use lowercase letters and numbers only. )
なぜこういう制限があるかというとおそらく、サービスのエンドポイントの URL の形式が以下のようになっていて、大文字と記号が使えないからだと思われます。
http://mystorageaccount.*.core.windows.net/*
ともかく、いくら PowerShell が "動詞-名詞" 形式の命名規則で、ストレージ アカウントを新たに作成するなら New
で StorageAccount
な感じかなーあーあったあったーってヘラヘラ使ってると、ときどきこんな落とし穴に…(普通ははまらないですね)。
第1回 PowerShell 勉強会に参加してきた
12月21日に開催された第1回 PowerShell 勉強会に参加してきたのですが、内容は後述のリンクを見てもらうとして、雑感というか。
個人的に PowerShell は登場してから結構年月が経っているにもかかわらず利用者がそれほど多くないという印象を持っていて、だからというわけではないですが PowerShell というカテゴリでの勉強会に魅力を感じて参加してみた結果、想像以上に面白い勉強会だったと思っています。
また、登壇者をはじめとして PowerShell を様々な形で利用している(利用できる)のは公開されているスライドを見れば明らかで、現時点でも PowerShell は非常に強力な言語で今後さらによくなっていくものと思われます(vbs とは対照的に)。
一方で、勉強会の中でWindows PowerShell イン アクションは聖書みたいな話があって、それに異論はないのですが in Action の Second Edition も in Depth も Deep Dive も出版されているにもかかわらず翻訳されていない、v3 に対応している日本語の書籍が @mutaguchi 氏著の【改訂新版】 Windows PowerShell ポケットリファレンスだけ(?)みたいな状況を見るに Windows 系エンジニアは基本的に英語の書籍が読めて翻訳書籍の需要がないか、PowerShell に興味がないかのどっちかで、どちらかというと後者っぽい雰囲気を"ソースは俺"レベルの観測範囲で感じますが実際のところどうなんでしょうか。
懇親会の時にも、PowerShell について日本語でぐぐると結構な確率で @mutaguchi 氏か @guitarrapc_tech 氏の記事が出てくるよねっていう話をちょっとしていたのですが、PowerShell Advent Calendar レベルでほかの人ももっとエントリーを書いて PowerShell のググラビリティをあげていくと、例えばサーバー構成においてスクリーン ショットとセットになったエクセル手順書は必須みたいな世界にさよならできる、みたいないいことがあったりするのかなと PowerShell 推進派としては思ったのでした(最初からそんな世界自体が藁人形だったらいいのですが)。
- 第1回 PowerShell勉強会に参加してきました
- 第一回 PowerShell 勉強会を開催時のセッション資料公開 と舞台裏とか
- 第1回 PowerShell勉強会で「PowerShell Desired State Configuration (DSC) について」というセッションをしました
- 第1回PowerShell勉強会で「C#からPowerShellを使ってみる」でお話しました
- PowerShellにMSBuildLauncherで簡易GUIをつける
- Aws tools for power shellをつかいこなそう
- Power shell で DSL
- 第1回 PowerShell勉強会 #jpposh ツイートまとめ
ところで会場の株式会社グラニにある UFO キャッチャーを試す権利を得た人の中で一人だけマスコットをゲットできなかったのがこちらのあかうんt(ry
PowerShell DSC を実際に動かしてみる
※これは PowerShell Advent Calendar 2013: ATND 14 日目の記事です。
Windows 8.1 および Windows Server 2012 R2 が発表されてからしばらく経ちますが、PowerShell DSC に関する情報や手順があんまり出ていないようですので(公式もまだですよね?)、正式な情報が揃うまでの間でちょっと触ってみようということで簡単な構成を作ってみました。
そもそも PowerShell DSC が何かということについては @guitarrapc_tech 氏がご自身のブログで丁寧に説明されていますので丸投げしてしまいます。
環境を準備する
まず、PSDSC を実行する環境ですが、基本的には IIS が動かせるコンピューターと DSC 適用対象のコンピューターの2台程度があればいいです。もちろんもっと DSC 適用対象コンピューターを用意すると構成情報の大量のコピペが楽しめます。ドメインを構成しているほうがコンピューター間の通信が簡単にできるんじゃないかなとは思いますが、スタンドアロン構成で実施するかどうかはお好みで…。
構成例:
- PSDSCHost001 (DC, DSC: WS2012 R2)
- PSDSCClient001 (WS2012 R2)
DSC の管理サーバー(?)を構成する
では早速 PSDSCHost001 上で PowerShell を起動し、Windows PowerShell Desired State Configuration Service
機能をインストールします。GUI でもなんでも結構ですが、せっかくなので PowerShell で。この機能、のちに適切な日本語に変更されたりするんでしょうか…。MCP の翻yいえなんでもありません。
PS > Install-WindowsFeature DSC-Service
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Windows PowerShell Desired State Configur...
上のコマンドレットを実行して成功していることを確認します。関連する機能として Web-Server
の一部の機能もインストールされます。今回は使いませんすみませんすみません。続いて Desired State Configuration ファイルを作ります。こんな感じ。
PS > New-Item c:\PSDSC -ItemType Directory
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2013/12/13 20:19 PSDSC
PS > New-Item c:\PSDSC\IISConfig.ps1 -ItemType File
Directory: C:\PSDSC
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2013/12/13 20:19 0 iisconfig.ps1
で、作成した IISConfig.ps1
ファイルを開いて以下の内容を書き込んで保存、実行します。
Configuration IISConfiguration
{
Node PSDSCClient001
{
WindowsFeature IIS
{
Ensure = "Present"
Name = "Web-Server"
}
WindowsFeature ASP
{
Ensure = "Present"
Name = "Web-Asp-Net45"
}
}
}
IISConfiguration
実行すると PowerShell のカレント ディレクトリ(Get-Location
で表示されるディレクトリ)に MOF ファイルが作成されます。
PS > C:\PSDSC\iisconfig.ps1
Directory: C:\PSDSC\WebSiteConfig
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2013/12/13 20:54 1732 PSDSCClient001.mof
これで準備は完了です。
DSC でクライアントに IIS を展開する
まずは DSC 適用前の PSDSCCllient001 に PowerShell で接続して機能のインストール状態を確認します。Get-Credential
のクレデンシャル認証は PSDSCClient001 に対して十分な権限があれば何でもいいです(Domain Admins とかw)。
PS > Enter-PSSession -ComputerName PSDSCClient001 -Credential $(Get-Credential)
問題なく接続できれば、プロンプトの部分が [PSDSCClient001]: PS >
みたいな形になりますので Get-WindowsFeature
を実行します。
[PSDSCClient001]: PS > Get-WindowsFeature -Name Web*
Display Name Name Install State
------------ ---- -------------
[ ] Web サーバー (IIS) Web-Server Available
[ ] Web サーバー Web-WebServer Available
[ ] HTTP 共通機能 Web-Common-Http Available
[ ] HTTP エラー Web-Http-Errors Available
[ ] ディレクトリの参照 Web-Dir-Browsing Available
[ ] 既定のドキュメント Web-Default-Doc Available
[ ] 静的なコンテンツ Web-Static-Content Available
[ ] HTTP リダイレクト Web-Http-Redirect Available
[ ] WebDAV 発行 Web-DAV-Publishing Available
[ ] .NET 拡張機能 4.5 Web-Net-Ext45 Available
[ ] Application Initialization Web-AppInit Available
[ ] ASP Web-ASP Available
[ ] ASP.NET 3.5 Web-Asp-Net Available
[ ] ASP.NET 4.5 Web-Asp-Net45 Available
※途中割愛してます
こんな感じでまだ何もインストールされていないことを確認したら PSSession は Exit しておきます。では DSC を実行してみましょう。
Start-DscConfiguration -ComputerName PSDSCClient001 -Path IISConfiguration -Wait -Verbose -Credential $(Get-Credential)
するとこんな感じの結果が表示されます。
ここで、もう一度 PowerShell から先ほどと同じコマンドレットを実行して PSDSCClient001 に接続し、機能のインストール状況を確認してみると…
[PSDSCClient001]: PS > Get-WindowsFeature -Name web*
Display Name Name Install State
------------ ---- -------------
[X] Web サーバー (IIS) Web-Server Installed
[X] Web サーバー Web-WebServer Installed
[X] HTTP 共通機能 Web-Common-Http Installed
[X] HTTP エラー Web-Http-Errors Installed
[X] ディレクトリの参照 Web-Dir-Browsing Installed
[X] 既定のドキュメント Web-Default-Doc Installed
[X] 静的なコンテンツ Web-Static-Content Installed
[ ] HTTP リダイレクト Web-Http-Redirect Available
[ ] WebDAV 発行 Web-DAV-Publishing Available
[X] .NET 拡張機能 4.5 Web-Net-Ext45 Installed
[ ] Application Initialization Web-AppInit Available
[ ] ASP Web-ASP Available
[ ] ASP.NET 3.5 Web-Asp-Net Available
[X] ASP.NET 4.5 Web-Asp-Net45 Installed
※途中割愛してます
インストールされてますね!ということで本当はウェブサイトを作ってコンテンツも一緒に DSC で構成したほうがデモっぽい感じですが、そういうのはブログよりも動画で見るほうがおおーっ!ってなるので Channel 9 で公開されている Teched 2013 の Desired State Configuration in Windows Server 2012 R2 PowerShell でカップケーキのウェブサイトが増殖する様子を見てもらえればと思います。
追記
そういえばせっかく Desired State Configuration って言っているのに構成済みの環境に再度 DSC を適用したときにどんな振る舞いをするのかについても結果を書いておいた方がいいかなと思いますので、実行したら追記しようと思います。環境もうつぶしちゃった (・ω<)
あと、全然本文とは関係ないですがブロガーなら誰しも、ふと書き続けていたブログをぶち壊したくなる衝動に駆られることがあるかと思いますが、多分に漏れず私もその衝動のままにこれまで使っていたブログを消去し、ここからまた始めることにしました。
ということでこれが最新の記事となります()