Feb 25, 2007

[dotNet] Windows PowerShell にチャレンジ (6)

サンプルスクリプトの実行

List Basic Computer Information
http://www.microsoft.com/technet/scriptcenter/scripts/msh/hardware/basic/hwbams01.mspx
を試しに実行してみた。 ページに記述されているスクリプトを ListBasicComputerInformation.ps1 というファイルに貼り付けて Windows PowerShell のコンソールから実行してみる。
PS C:\> .\ListBasicComputerInformation.ps1
File C:\ListBasicComputerInformation.ps1 cannot be loaded because the execution
 of scripts is disabled on this system. Please see "get-help about_signing" for
 more details.
At line:1 char:34
+ .\ListBasicComputerInformation.ps1 <<<<
PS C:\>
セキュリティポリシーに引っかかってしまった(^^;
PS C:\> Get-ExecutionPolicy
Restricted
PS C:\> Set-ExecutionPolicy RemoteSigned
PS C:\>
でセキュリティポリシーをローカルのスクリプトファイルは署名無しで実行出来るように変更。
PS C:\> .\ListBasicComputerInformation.ps1
Administrator Password Status:  3
Automatic Reset Boot Option:  True
Automatic Reset Capability:  True
Boot Option On Limit:
Boot Option On WatchDog:
Boot ROM Supported:  True
Bootup State:  Normal boot
     (略)
WakeUp Type:  7
Workgroup:

PS C:\>
ということで、PC の基本情報を取得することが出来た。

Posted in dotNet | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 23, 2007

[dotNet] Windows PowerShell にチャレンジ (5)

一通り基本的なところを眺め終わったので、スクリプトのサンプルを見てみることに。 Microsoft のサイトに Windows PowerShell のサンプルスクリプト用リポジトリが用意されている。 結構充実していて勉強にはもってこいな感じ。

Scripting with Windows PowerShell
http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
The Script Center Script Repository: Sample Windows PowerShell Scripts
http://www.microsoft.com/technet/scriptcenter/scripts/msh/default.mspx

提供されているサンプルスクリプト

  • Active Directory - Sample scripts for managing Active Directory and Active Directory objects.
    • Domains - Sample scripts for managing Active Directory domains.
      • List Domain Information
  • Applications - Sample scripts for managing software and applications on servers and client computers.
    • Client Applications - Sample scripts for managing software on user computers, including scripts for installing, updating, and deleting software installed using Windows Installer.
      • List Information About the Binary Files Used by an Application
      • List Installed Software
      • List Installed Software Features
      • List the Codec Files on a Computer
  • Desktop Management - Sample scripts for managing such things as desktop settings, computer startup and shutdown, and System Restore.
    • Logon Sessions - Sample scripts for retrieving information about computer logon sessions, including identifying the user logged on to a remote computer.
      • List Logon Session Information
    • Startup and Shutdown - Sample scripts for managing Windows startup settings and for shutting down computers.
      • List Computer Startup Commands
      • List Recovery Configuration Options
      • List the Boot Configuration Properties of a Computer
    • Windows Activation - Sample scripts for managing Windows Activation, including scripts for activating Windows both online and offline.
      • List Windows Product Activation Status
    • Windows and Windows Explorer Settings - Sample scripts for configuring Windows and Windows Explorer settings.
      • List Desktop Settings
      • List Environment Variables on a Computer
      • List Shortcuts on a Computer
      • List Start Menu Groups
      • List Start Menu Items
      • List Start Menu Program Groups
  • Hardware - Sample scripts for managing and monitoring computer hardware.
    • Basic Hardware and Firmware - Sample scripts for retrieving information about the hardware and firmware installed on a computer.
      • List Basic Computer Information
      • List Computer Baseboard Properties
      • List Computer Bus Properties
      • List Computer Chassis Information
      • List Computer Fan Information
      • List Infrared Device Information
      • List IRQ Settings
      • List Motherboard Device Information
      • List Onboard Devices
      • List Processor Information
    • Batteries and Power Supplies - Sample scripts for retrieving information about batteries and power supplies installed in a computer.
      • List Battery Information
      • List Portable Battery Information
      • List UPS Information
    • Memory - Sample scripts for retrieving information about the physical memory installed in a computer.
      • List Cache Memory Information
      • List Device Memory Addresses
      • List DMA Channel Information
      • List Memory Array Information
      • List Memory Devices
      • List Physical Memory Properties
      • List Physical Memory Array Properties
    • Peripherals and Devices - Sample scripts for retrieving information about peripherals and other devices installed on a computer.
      • List Keyboard Properties
      • List Modem Information
      • List Plug and Play Devices
      • List Plug and Play Signed Drivers
      • List Pointing Device Properties
      • List Sound Card Properties
    • Ports and Slots - Sample scripts for retrieving information about ports and system slots installed in a computer.
      • List 1394 Controller Settings
      • List Parallel Port Properties
      • List PCMCIA Controller Information
      • List Port Connector Properties
      • List Port Resource Information
      • List Serial Port Configuration Properties
      • List Serial Port Properties
      • List System Slot Properties
    • Video and Display - Sample scripts for retrieving information about video controllers, display cards, and monitors installed on a computer.
      • List Current Display Configuration Values
      • List Desktop Monitor Properties
      • List Display Controller Configuration Settings
      • List Video Controller Properties
  • Logs - Sample scripts for managing event logs and plain-text log files.
    • Event Logs - Sample scripts for managing event logs (for example, backing up and clearing event logs), and for retrieving events from event logs.
      • List Event Log Properties
      • List Events from the Event Logs
  • Networking - Sample scripts for managing and monitoring network configurations and network applications.
    • Client-Side Management - Sample scripts for configuring TCP/IP settings (IP address, DNS Server, WINS Server, etc.) on client computers.
      • Retrieving Network Configuration Information - Sample scripts for retrieving information about TCP/IP settings on client computers.
        • List IP4 Route Table Information
        • List Network Adapter Configuration Properties
        • List Network Adapter Properties
        • List Network Client Information
        • List Network Login Profiles
        • List Proxy Server Information
        • List the Network Protocols on a Computer
  • Operating System - Sample scripts for managing and monitoring the Windows operating system.
    • COM and DCOM - Sample scripts for retrieving information about COM and DCOM settings and classes found on a computer.
      • List Classic COM Class Settings
      • List Classic COM Classes
      • List Component Categories
      • List DCOM Application Settings
      • List DCOM Applications
      • List ProgIDs
    • Dates and Times - Sample scripts for retrieving date and time information (including local time and time zone information) from computers.
      • List the Local Time on a Computer
      • List Time Zone Information for a Computer
    • Page Files - Sample scripts for retrieving information from and configuring page files.
      • List Page File Properties
      • List Page File Settings
      • List Page File Use
    • Processes - Sample scripts for managing and monitoring the processes running on a computer.
      • Processes and Threads - Sample scripts for managing processes and threads, including scripts for creating new processes and terminating existing processes.
        • List Information about the Threads Active on a Computer
        • List the Processes Running on a Computer
    • Registry - Sample scripts from retrieving information from and writing information to the Windows registry.
      • List Registry Properties
    • Services - Sample scripts for managing Windows services and for listing and/or modifying the properties of those services.
      • List Service Load Order Groups
      • List Service Properties
    • Task Scheduling - Sample scripts for creating, modifying, and deleting scheduled jobs on a computer.
      • List Scheduled Tasks
    • Version Information - Sample scripts for retrieving information about the version of Windows installed on a computer.
      • List Operating System Properties
  • Other Directory Services - Sample scripts for managing directory services other than Active Directory.
    • Local Accounts and Windows NT 4.0 Accounts - Sample scripts for managing user and group accounts on local computers and in Windows NT 4.0 domains.
      • Groups - Sample scripts for managing security groups on local computers and/or in Windows NT 4.0 domains.
        • List Group Information
      • User Accounts - Sample scripts for managing user accounts on local computers and/or in Windows NT 4.0 domains.
        • List User Account Information
  • Printing - Sample scripts for managing printers, print jobs, print servers, and other parts of the Windows printing infrastructure.
    • Print Servers, Print Queues, and Print Jobs - Sample scripts for managing print servers, print queues, and individual print jobs.
      • List Print Job Information
      • List Printer Capabilities
      • List Printer Information
    • Printer Ports and Printer Drivers - Sample scripts for retrieving information about and for configuring printer ports and printer drivers on a computer.
      • List Printer Drivers
      • List Printer Port Properties
  • Scripting Techniques - Sample scripts demonstrating a wide variety of scripting tips, tricks, and techniques useful to script writers.
    • Dates and Times - Sample scripts for manipulating dates and times, particularly the UTC times used by WMI.
      • List the UTC Time on a Computer
    • WMI - Sample scripts for retrieving information about objects that can be used in WMI scripts.
      • List WMI Setting Information
  • Service Packs and Hot Fixes - Sample scripts for retrieving information about service packs and hot fixes installed on a computer.
    • List Installed Hot Fixes
  • Storage - Sample scripts for managing files, folders, file systems, and storage devices.
    • Disk Drives and Volumes
    • Disk Quotas
    • Folders
    • Shared Folders
  • Terminal Server - Sample scripts for managing Windows Terminal Server.
    • Retrieving Terminal Server Properties - Sample scripts for retrieving information about Terminal Server configuration settings.
      • List Terminal Service Service Properties
      • List Terminal Services Accounts
      • List Terminal Services Client Settings
      • List Terminal Services Environment Settings
      • List Terminal Services General Settings
      • List Terminal Services Logon Settings
      • List Terminal Services Network Adapter List Settings
      • List Terminal Services Network Adapter Settings
      • List Terminal Services Permission Settings
      • List Terminal Services Remote Control Settings
      • List Terminal Services Session Directory Settings
      • List Terminal Services Session Settings
      • List Terminal Services Terminal Settings
      • List Terminal Services Terminals

Posted in dotNet | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 22, 2007

[dotNet] Windows PowerShell にチャレンジ (4)

Windows PowerShell のリファレンス

Windows PowerShell の演算子や変数の取り扱い、制御文などの詳細を知りたい場合はドキュメントパックをダウンロードする。 下のリンク先のページにある "Files in This Download" の "WindowsPowerShell_Localized_DocumentationPack.zip" をダウンロードすると日本語のドキュメントを入手できる。

Windows PowerShell 1.0 Documentation Pack
http://www.microsoft.com/downloads/details.aspx?FamilyId=B4720B00-9A66-430F-BD56-EC48BFCA154F

リファレンスの内容

ドキュメントパックでは以下のファイルが提供されている。

  • gettingStarted.rtf ・・・ Windows PowerShell ファースト ステップ ガイド
  • quadfold.rtf ・・・ Windows PowerShell ランゲージ クイック リファレンス
  • releaseNotes.rtf ・・・ Windows PowerShell V1.0 (.NET Framework 2.0 RTM 用) Release Notes
  • userGuide.rtf ・・・ Windows PowerShell 入門
とりあえず、演算子や制御文などはクイックリファレンスを見ると手っ取り早い。 もう少し細かくオブジェクトのことを知りたい場合は入門を参照。

とりあえず foreach が使えることが分かったので、Get-Command で試してみた。
PS C:\> foreach($command in Get-Command){if($command.Name.contains("Get-")){$co
mmand}}

CommandType     Name                            Definition
-----------     ----                            ----------
Cmdlet          Get-Acl                         Get-Acl [[-Path] <String[]>]...
Cmdlet          Get-Alias                       Get-Alias [[-Name] <String[]...
Cmdlet          Get-AuthenticodeSignature       Get-AuthenticodeSignature [-...
Cmdlet          Get-ChildItem                   Get-ChildItem [[-Path] <Stri...
Cmdlet          Get-Command                     Get-Command [[-ArgumentList]...
Cmdlet          Get-Content                     Get-Content [-Path] <String[...
Cmdlet          Get-Credential                  Get-Credential [-Credential]...
Cmdlet          Get-Culture                     Get-Culture [-Verbose] [-Deb...
Cmdlet          Get-Date                        Get-Date [[-Date] <DateTime>...
Cmdlet          Get-EventLog                    Get-EventLog [-LogName] <Str...
Cmdlet          Get-ExecutionPolicy             Get-ExecutionPolicy [-Verbos...
Cmdlet          Get-Help                        Get-Help [[-Name] <String>] ...
Cmdlet          Get-History                     Get-History [[-Id] <Int64[]>...
Cmdlet          Get-Host                        Get-Host [-Verbose] [-Debug]...
Cmdlet          Get-Item                        Get-Item [-Path] <String[]> ...
Cmdlet          Get-ItemProperty                Get-ItemProperty [-Path] <St...
Cmdlet          Get-Location                    Get-Location [-PSProvider <S...
Cmdlet          Get-Member                      Get-Member [[-Name] <String[...
Cmdlet          Get-PfxCertificate              Get-PfxCertificate [-FilePat...
Cmdlet          Get-Process                     Get-Process [[-Name] <String...
Cmdlet          Get-PSDrive                     Get-PSDrive [[-Name] <String...
Cmdlet          Get-PSProvider                  Get-PSProvider [[-PSProvider...
Cmdlet          Get-PSSnapin                    Get-PSSnapin [[-Name] <Strin...
Cmdlet          Get-Service                     Get-Service [[-Name] <String...
Cmdlet          Get-TraceSource                 Get-TraceSource [[-Name] <St...
Cmdlet          Get-UICulture                   Get-UICulture [-Verbose] [-D...
Cmdlet          Get-Unique                      Get-Unique [-InputObject <PS...
Cmdlet          Get-Variable                    Get-Variable [[-Name] <Strin...
Cmdlet          Get-WmiObject                   Get-WmiObject [-Class] <Stri...


PS C:\>

Posted in dotNet | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 21, 2007

[dotNet] Windows PowerShell にチャレンジ (3)

Windows PowerShell のヘルプ機能

コマンドの使用方法が良く分からないものも多数あるので、ヘルプを表示してみる。

PS C:\> Help Get-Date

NAME
    Get-Date

SYNOPSIS
    Gets the current date and time.


SYNTAX
    Get-Date [[-date] <DateTime>] [-displayHint {<Date> | <Time> | <DateTime>}]
     [-format <string>] [-year <int>] [-month <int>] [-day <int>] [-hour <int>]
     [-minute <int>] [-second <int>] [<CommonParameters>]

    Get-Date [[-date] <DateTime>] [-displayHint {<Date> | <Time> | <DateTime>}]
     [-uFormat <string>] [-year <int>] [-month <int>] [-day <int>] [-hour <int>
    ] [-minute <int>] [-second <int>] [<CommonParameters>]


DETAILED DESCRIPTION
    Gets the current date and time.


RELATED LINKS
    Set-Date
    New-TimeSpan

REMARKS
    For more information, type: "get-help Get-Date -detailed".
    For technical information, type: "get-help Get-Date -full".

PS C:\>
ということで、Get-Date の使用方法が分かったので、ちょっと使ってみる。
PS C:\> Get-Date -format yyyy
2007
PS C:\> Get-Date -format yyyyMMdd
20070129
PS C:\> Get-Date -format yyyyMMddHHmmss
20070129013010
PS C:\>
ちなみに、UNIX 風に問い合わせてみると、
PS C:\> man date

Name                       Category                   Synopsis
----                       --------                   --------
Get-Date                   Cmdlet                     Gets the current date ...
Set-Date                   Cmdlet                     Changes the system tim...
となった。やはり "Get-Help Get-Date" で問い合わせてくれ、ということなのだろう。

Posted in dotNet | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 18, 2007

[dotNet] Windows PowerShell にチャレンジ (2)

Windows PowerShell のコマンド一覧

Get-Command でコマンド一覧を表示できる。 .Net を使ったことがないので馴染みの無いコマンドばかり。 機能を類推し易い命名になっているので有り難い。

PS C:\> Get-Command | sort

CommandType     Name                            Definition
-----------     ----                            ----------
Cmdlet          Add-Content                     Add-Content [-Path] <String[...
Cmdlet          Add-History                     Add-History [[-InputObject] ...
Cmdlet          Add-Member                      Add-Member [-MemberType] <PS...
Cmdlet          Add-PSSnapin                    Add-PSSnapin [-Name] <String...
Cmdlet          Clear-Content                   Clear-Content [-Path] <Strin...
Cmdlet          Clear-Item                      Clear-Item [-Path] <String[]...
Cmdlet          Clear-ItemProperty              Clear-ItemProperty [-Path] <...
Cmdlet          Clear-Variable                  Clear-Variable [-Name] <Stri...
Cmdlet          Compare-Object                  Compare-Object [-ReferenceOb...
Cmdlet          ConvertFrom-SecureString        ConvertFrom-SecureString [-S...
Cmdlet          Convert-Path                    Convert-Path [-Path] <String...
Cmdlet          ConvertTo-Html                  ConvertTo-Html [[-Property] ...
Cmdlet          ConvertTo-SecureString          ConvertTo-SecureString [-Str...
Cmdlet          Copy-Item                       Copy-Item [-Path] <String[]>...
Cmdlet          Copy-ItemProperty               Copy-ItemProperty [-Path] <S...
Cmdlet          Export-Alias                    Export-Alias [-Path] <String...
Cmdlet          Export-Clixml                   Export-Clixml [-Path] <Strin...
Cmdlet          Export-Console                  Export-Console [[-Path] <Str...
Cmdlet          Export-Csv                      Export-Csv [-Path] <String> ...
Cmdlet          ForEach-Object                  ForEach-Object [-Process] <S...
Cmdlet          Format-Custom                   Format-Custom [[-Property] <...
Cmdlet          Format-List                     Format-List [[-Property] <Ob...
Cmdlet          Format-Table                    Format-Table [[-Property] <O...
Cmdlet          Format-Wide                     Format-Wide [[-Property] <Ob...
Cmdlet          Get-Acl                         Get-Acl [[-Path] <String[]>]...
Cmdlet          Get-Alias                       Get-Alias [[-Name] <String[]...
Cmdlet          Get-AuthenticodeSignature       Get-AuthenticodeSignature [-...
Cmdlet          Get-ChildItem                   Get-ChildItem [[-Path] <Stri...
Cmdlet          Get-Command                     Get-Command [[-ArgumentList]...
Cmdlet          Get-Content                     Get-Content [-Path] <String[...
Cmdlet          Get-Credential                  Get-Credential [-Credential]...
Cmdlet          Get-Culture                     Get-Culture [-Verbose] [-Deb...
Cmdlet          Get-Date                        Get-Date [[-Date] <DateTime>...
Cmdlet          Get-EventLog                    Get-EventLog [-LogName] <Str...
Cmdlet          Get-ExecutionPolicy             Get-ExecutionPolicy [-Verbos...
Cmdlet          Get-Help                        Get-Help [[-Name] <String>] ...
Cmdlet          Get-History                     Get-History [[-Id] <Int64[]>...
Cmdlet          Get-Host                        Get-Host [-Verbose] [-Debug]...
Cmdlet          Get-Item                        Get-Item [-Path] <String[]> ...
Cmdlet          Get-ItemProperty                Get-ItemProperty [-Path] <St...
Cmdlet          Get-Location                    Get-Location [-PSProvider <S...
Cmdlet          Get-Member                      Get-Member [[-Name] <String[...
Cmdlet          Get-PfxCertificate              Get-PfxCertificate [-FilePat...
Cmdlet          Get-Process                     Get-Process [[-Name] <String...
Cmdlet          Get-PSDrive                     Get-PSDrive [[-Name] <String...
Cmdlet          Get-PSProvider                  Get-PSProvider [[-PSProvider...
Cmdlet          Get-PSSnapin                    Get-PSSnapin [[-Name] <Strin...
Cmdlet          Get-Service                     Get-Service [[-Name] <String...
Cmdlet          Get-TraceSource                 Get-TraceSource [[-Name] <St...
Cmdlet          Get-UICulture                   Get-UICulture [-Verbose] [-D...
Cmdlet          Get-Unique                      Get-Unique [-InputObject <PS...
Cmdlet          Get-Variable                    Get-Variable [[-Name] <Strin...
Cmdlet          Get-WmiObject                   Get-WmiObject [-Class] <Stri...
Cmdlet          Group-Object                    Group-Object [[-Property] <O...
Cmdlet          Import-Alias                    Import-Alias [-Path] <String...
Cmdlet          Import-Clixml                   Import-Clixml [-Path] <Strin...
Cmdlet          Import-Csv                      Import-Csv [-Path] <String[]...
Cmdlet          Invoke-Expression               Invoke-Expression [-Command]...
Cmdlet          Invoke-History                  Invoke-History [[-Id] <Strin...
Cmdlet          Invoke-Item                     Invoke-Item [-Path] <String[...
Cmdlet          Join-Path                       Join-Path [-Path] <String[]>...
Cmdlet          Measure-Command                 Measure-Command [-Expression...
Cmdlet          Measure-Object                  Measure-Object [[-Property] ...
Cmdlet          Move-Item                       Move-Item [-Path] <String[]>...
Cmdlet          Move-ItemProperty               Move-ItemProperty [-Path] <S...
Cmdlet          New-Alias                       New-Alias [-Name] <String> [...
Cmdlet          New-Item                        New-Item [-Path] <String[]> ...
Cmdlet          New-ItemProperty                New-ItemProperty [-Path] <St...
Cmdlet          New-Object                      New-Object [-TypeName] <Stri...
Cmdlet          New-PSDrive                     New-PSDrive [-Name] <String>...
Cmdlet          New-Service                     New-Service [-Name] <String>...
Cmdlet          New-TimeSpan                    New-TimeSpan [[-Start] <Date...
Cmdlet          New-Variable                    New-Variable [-Name] <String...
Cmdlet          Out-Default                     Out-Default [-InputObject <P...
Cmdlet          Out-File                        Out-File [-FilePath] <String...
Cmdlet          Out-Host                        Out-Host [-Paging] [-InputOb...
Cmdlet          Out-Null                        Out-Null [-InputObject <PSOb...
Cmdlet          Out-Printer                     Out-Printer [[-Name] <String...
Cmdlet          Out-String                      Out-String [-Stream] [-Width...
Cmdlet          Pop-Location                    Pop-Location [-PassThru] [-S...
Cmdlet          Push-Location                   Push-Location [[-Path] <Stri...
Cmdlet          Read-Host                       Read-Host [[-Prompt] <Object...
Cmdlet          Remove-Item                     Remove-Item [-Path] <String[...
Cmdlet          Remove-ItemProperty             Remove-ItemProperty [-Path] ...
Cmdlet          Remove-PSDrive                  Remove-PSDrive [-Name] <Stri...
Cmdlet          Remove-PSSnapin                 Remove-PSSnapin [-Name] <Str...
Cmdlet          Remove-Variable                 Remove-Variable [-Name] <Str...
Cmdlet          Rename-Item                     Rename-Item [-Path] <String>...
Cmdlet          Rename-ItemProperty             Rename-ItemProperty [-Path] ...
Cmdlet          Resolve-Path                    Resolve-Path [-Path] <String...
Cmdlet          Restart-Service                 Restart-Service [-Name] <Str...
Cmdlet          Resume-Service                  Resume-Service [-Name] <Stri...
Cmdlet          Select-Object                   Select-Object [[-Property] <...
Cmdlet          Select-String                   Select-String [-Pattern] <St...
Cmdlet          Set-Acl                         Set-Acl [-Path] <String[]> [...
Cmdlet          Set-Alias                       Set-Alias [-Name] <String> [...
Cmdlet          Set-AuthenticodeSignature       Set-AuthenticodeSignature [-...
Cmdlet          Set-Content                     Set-Content [-Path] <String[...
Cmdlet          Set-Date                        Set-Date [-Date] <DateTime> ...
Cmdlet          Set-ExecutionPolicy             Set-ExecutionPolicy [-Execut...
Cmdlet          Set-Item                        Set-Item [-Path] <String[]> ...
Cmdlet          Set-ItemProperty                Set-ItemProperty [-Path] <St...
Cmdlet          Set-Location                    Set-Location [[-Path] <Strin...
Cmdlet          Set-PSDebug                     Set-PSDebug [-Trace <Int32>]...
Cmdlet          Set-Service                     Set-Service [-Name] <String>...
Cmdlet          Set-TraceSource                 Set-TraceSource [-Name] <Str...
Cmdlet          Set-Variable                    Set-Variable [-Name] <String...
Cmdlet          Sort-Object                     Sort-Object [[-Property] <Ob...
Cmdlet          Split-Path                      Split-Path [-Path] <String[]...
Cmdlet          Start-Service                   Start-Service [-Name] <Strin...
Cmdlet          Start-Sleep                     Start-Sleep [-Seconds] <Int3...
Cmdlet          Start-Transcript                Start-Transcript [[-Path] <S...
Cmdlet          Stop-Process                    Stop-Process [-Id] <Int32[]>...
Cmdlet          Stop-Service                    Stop-Service [-Name] <String...
Cmdlet          Stop-Transcript                 Stop-Transcript [-Verbose] [...
Cmdlet          Suspend-Service                 Suspend-Service [-Name] <Str...
Cmdlet          Tee-Object                      Tee-Object [-FilePath] <Stri...
Cmdlet          Test-Path                       Test-Path [-Path] <String[]>...
Cmdlet          Trace-Command                   Trace-Command [-Name] <Strin...
Cmdlet          Update-FormatData               Update-FormatData [[-AppendP...
Cmdlet          Update-TypeData                 Update-TypeData [[-AppendPat...
Cmdlet          Where-Object                    Where-Object [-FilterScript]...
Cmdlet          Write-Debug                     Write-Debug [-Message] <Stri...
Cmdlet          Write-Error                     Write-Error [-Message] <Stri...
Cmdlet          Write-Host                      Write-Host [[-Object] <Objec...
Cmdlet          Write-Output                    Write-Output [-InputObject] ...
Cmdlet          Write-Progress                  Write-Progress [-Activity] <...
Cmdlet          Write-Verbose                   Write-Verbose [-Message] <St...
Cmdlet          Write-Warning                   Write-Warning [-Message] <St...


PS C:\>

Windows PowerShell のエイリアス一覧

Get-Alias でコマンドに割り当てられたエイリアスを一覧表示できる。 UNIX 系コマンドをかなり意識したエイリアスがデフォルトで用意されているので、UNIX に慣れていればエイリアスが便利そう。

PS C:\> Get-Alias | sort

CommandType     Name                            Definition
-----------     ----                            ----------
Alias           %                               ForEach-Object
Alias           ?                               Where-Object
Alias           ac                              Add-Content
Alias           asnp                            Add-PSSnapin
Alias           cat                             Get-Content
Alias           cd                              Set-Location
Alias           chdir                           Set-Location
Alias           clc                             Clear-Content
Alias           clear                           Clear-Host
Alias           cli                             Clear-Item
Alias           clp                             Clear-ItemProperty
Alias           cls                             Clear-Host
Alias           clv                             Clear-Variable
Alias           copy                            Copy-Item
Alias           cp                              Copy-Item
Alias           cpi                             Copy-Item
Alias           cpp                             Copy-ItemProperty
Alias           cvpa                            Convert-Path
Alias           del                             Remove-Item
Alias           diff                            Compare-Object
Alias           dir                             Get-ChildItem
Alias           echo                            Write-Output
Alias           epal                            Export-Alias
Alias           epcsv                           Export-Csv
Alias           erase                           Remove-Item
Alias           fc                              Format-Custom
Alias           fl                              Format-List
Alias           foreach                         ForEach-Object
Alias           ft                              Format-Table
Alias           fw                              Format-Wide
Alias           gal                             Get-Alias
Alias           gc                              Get-Content
Alias           gci                             Get-ChildItem
Alias           gcm                             Get-Command
Alias           gdr                             Get-PSDrive
Alias           ghy                             Get-History
Alias           gi                              Get-Item
Alias           gl                              Get-Location
Alias           gm                              Get-Member
Alias           gp                              Get-ItemProperty
Alias           gps                             Get-Process
Alias           group                           Group-Object
Alias           gsnp                            Get-PSSnapin
Alias           gsv                             Get-Service
Alias           gu                              Get-Unique
Alias           gv                              Get-Variable
Alias           gwmi                            Get-WmiObject
Alias           h                               Get-History
Alias           history                         Get-History
Alias           iex                             Invoke-Expression
Alias           ihy                             Invoke-History
Alias           ii                              Invoke-Item
Alias           ipal                            Import-Alias
Alias           ipcsv                           Import-Csv
Alias           kill                            Stop-Process
Alias           lp                              Out-Printer
Alias           ls                              Get-ChildItem
Alias           mi                              Move-Item
Alias           mount                           New-PSDrive
Alias           move                            Move-Item
Alias           mp                              Move-ItemProperty
Alias           mv                              Move-Item
Alias           nal                             New-Alias
Alias           ndr                             New-PSDrive
Alias           ni                              New-Item
Alias           nv                              New-Variable
Alias           oh                              Out-Host
Alias           popd                            Pop-Location
Alias           ps                              Get-Process
Alias           pushd                           Push-Location
Alias           pwd                             Get-Location
Alias           r                               Invoke-History
Alias           rd                              Remove-Item
Alias           rdr                             Remove-PSDrive
Alias           ren                             Rename-Item
Alias           ri                              Remove-Item
Alias           rm                              Remove-Item
Alias           rmdir                           Remove-Item
Alias           rni                             Rename-Item
Alias           rnp                             Rename-ItemProperty
Alias           rp                              Remove-ItemProperty
Alias           rsnp                            Remove-PSSnapin
Alias           rv                              Remove-Variable
Alias           rvpa                            Resolve-Path
Alias           sal                             Set-Alias
Alias           sasv                            Start-Service
Alias           sc                              Set-Content
Alias           select                          Select-Object
Alias           set                             Set-Variable
Alias           si                              Set-Item
Alias           sl                              Set-Location
Alias           sleep                           Start-Sleep
Alias           sort                            Sort-Object
Alias           sp                              Set-ItemProperty
Alias           spps                            Stop-Process
Alias           spsv                            Stop-Service
Alias           sv                              Set-Variable
Alias           tee                             Tee-Object
Alias           type                            Get-Content
Alias           where                           Where-Object
Alias           write                           Write-Output


PS C:\>

Windows PowerShell のコマンドを試してみる

試しに Get-Service を実行してサービスの一覧を表示してみた。

PS C:\> Get-Service

Status   Name               DisplayName
------   ----               -----------
Stopped  Alerter            Alerter
Running  ALG                Application Layer Gateway Service
Stopped  AppMgmt            Application Management
Stopped  aspnet_state       ASP.NET State Service
Running  AudioSrv           Windows Audio
    (略)
Running  wscsvc             Security Center
Running  wuauserv           Automatic Updates
Stopped  WZCSVC             Wireless Zero Configuration
Stopped  xmlprov            Network Provisioning Service


PS C:\>
きちんとサービスがリストアップされた(当たり前か)。 サービスの開始や停止も試してみることに。
PS C:\> Start-Service Themes
PS C:\> Get-Service Themes

Status   Name               DisplayName
------   ----               -----------
Running  Themes             Themes


PS C:\> Stop-Service Themes
PS C:\> Get-Service Themes

Status   Name               DisplayName
------   ----               -----------
Stopped  Themes             Themes


PS C:\>
非常に簡単にサービスの開始や停止ができた。 便利。

Posted in dotNet | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 16, 2007

[dotNet] Windows PowerShell にチャレンジ (1)

Windows PowerShell とは

Windows PowerShell は、Windows のコマンドライン機能を強化したものらしい。 要するに、cmd.exe の機能強化版ということだろう。 Windows PowerShell の公式サイトによると、

Microsoft Windows PowerShell command line shell and scripting language helps IT Professionals achieve greater productivity. Using a new admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT Professionals to more easily control system administration and accelerate automation.
というものだそうだ。 未だにバッチファイルで何とか凌いでいた(何ともならない場合は Linux (^^;) ので、Windows PowerShell を少し勉強してみることに。
Windows PowerShell Web Site
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx
Windows PowerShell Blog
http://blogs.msdn.com/powershell/
Knowledge Base Article
http://support.microsoft.com/kb/926139
Windows PowerShell SDK
http://msdn2.microsoft.com/en-us/library/aa830112.aspx
@IT - 次世代Windowsシェル「Windows PowerShell」を試す
http://www.atmarkit.co.jp/fdotnet/special/powershell01/powershell01_01.html

Windows PowerShell のインストール

Windows PowerShell は最近 1.0 がリリースされたばかりの様だが、Windows Vista だけでなく Windows XP 版も用意されている。 素晴らしい。 とりあえず Windows Vista 環境が無いので、Windows XP Professional 環境に Windows PowerShell をインストールしてみた。 インストール手順は以下の通り。

  1. .Net Framework 2.0 をインストール。Microsoft .NET Framework Version 2.0 Redistributable Package (x86)からアーカイブをダウンロードしてインストール。
  2. Windows PowerShell 1.0 をインストール。Windows PowerShell 1.0 English-Language Installation Package for Windows XP (KB926139)からアーカイブをダウンロードする。
    1. Windows PowerShell のダウンロードをするためには Genuine Check をする必要がある。指示に従い GenuineCheck.exe をダウンロードして実行する。
    2. GenuineCheck で表示されるコードをダウンロードサイトに入力すると Windows PowerShell のアーカイブ WindowsXP-KB926139-x86-ENU.exe がダウンロードできる。
    3. WindowsXP-KB926139-x86-ENU.exe を実行し、後はインストーラの指示に従い Windows PowerShell をインストールする。
[インストール画面(1)] [インストール画面(2)] [インストール画面(3)] [インストール画面(4)]

Windows PowerShell の実行

Windows PowerShell のインストーラがスタートメニューにも登録してくれるが、一々面倒なので「ファイル名を指定して実行」から "powershell.exe" を実行しても良い。 一見 cmd.exe と変わらないウィンドウが表示されるが、コマンドプロンプトの前に "PS" が付いているので Windows PowerShell が実行されていることが分かる。
[Windows PowerShell 実行] [Windows PowerShell ウィンドウ]
とりあえず使用できるコマンド一覧を表示してみる。

PS C:\> Get-Command | sort

CommandType     Name                            Definition
-----------     ----                            ----------
Cmdlet          Add-Content                     Add-Content [-Path] <String[...
Cmdlet          Add-History                     Add-History [[-InputObject] ...
Cmdlet          Add-Member                      Add-Member [-MemberType] <PS...
Cmdlet          Add-PSSnapin                    Add-PSSnapin [-Name] <String...
Cmdlet          Clear-Content                   Clear-Content [-Path] <Strin...
Cmdlet          Clear-Item                      Clear-Item [-Path] <String[]...
Cmdlet          Clear-ItemProperty              Clear-ItemProperty [-Path] <...
Cmdlet          Clear-Variable                  Clear-Variable [-Name] <Stri...
Cmdlet          Compare-Object                  Compare-Object [-ReferenceOb...
Cmdlet          ConvertFrom-SecureString        ConvertFrom-SecureString [-S...
Cmdlet          Convert-Path                    Convert-Path [-Path] <String...
Cmdlet          ConvertTo-Html                  ConvertTo-Html [[-Property] ...
Cmdlet          ConvertTo-SecureString          ConvertTo-SecureString [-Str...
Cmdlet          Copy-Item                       Copy-Item [-Path] <String[]>...
Cmdlet          Copy-ItemProperty               Copy-ItemProperty [-Path] <S...
Cmdlet          Export-Alias                    Export-Alias [-Path] <String...
         (略)
ということで、.Net Framework が提供してくれる機能をかなり利用できることが分かる。

Posted in dotNet | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 12, 2007

[Misc] 米国総合宅配サービス OPAS

OPAS というサービスを見つけた。 米国内に住所を持てるというサービスらしい。 宅配の転送なども請け負ってくれるそうなので、Amazon.com のマーケットプレイスで米国内のみ配達可能な商品の購入もできそう。 洋書の技術書を古本で大量購入するのに使えるかも。 ただ、コスト的に折り合うかどうか・・・。 何人かで共同利用すれば元は取れるかな??

OPAS
http://www.opasexpress.com/tanomail.htm
FAQ
http://www.opasexpress.com/tanomail_faq.htm
料金
http://www.opasexpress.com/tanomail_rates.htm

Posted in Misc | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 11, 2007

[Misc] Callisto

Callisto とは

Callisto は Eclipse のサブプロジェクトで、EMF、GEF、WTP、TPTP といったプラグインを同期してリリースすることを目的としているらしい。
Callisto プロジェクトのサイトによると

Callisto is about improving the productivity of the developers working on top of Eclipse frameworks by providing a more transparent and predictable development cycle. By releasing 10 projects at the same time, the goal is to eliminate uncertainty about version compatibility and make it easier to incorporate multiple projects into your environment.

While Callisto is about the simultaneous release of ten projects, it is not a unification of the projects - each project remains a separate open source project operating with its own project leadership, its own committers, and its own project plan.

ということだそうだ。

Callisto が現在対応してくれているのは、

  • Business Intelligence and Reporting Tools (BIRT) Project
  • C/C++ IDE (CDT)
  • Data Tools Platform (DTP)
  • Eclipse Modeling Framework (EMF)
  • Graphical Editing Framework (GEF)
  • Graphical Modeling Framework (GMF)
  • Eclipse Project
  • Eclipse Test and Performance Tools Platform Project (TPTP)
  • Eclipse Web Tools Platform Project (WTP)
  • Visual Editor (VE)
で、Java EE 開発で必要なプラグインはほとんど Callisto から取得できるのが分かる。 EMF、GEF、GMF、WTP、VE を一括で管理してくれるのは嬉しい限り。 とはいえ、プラグインのダウンロードに時間がかかるのは今まで通りなのだろうな・・・。 Callisto のリポジトリをそのまま適当な非公開サーバに構築出来ると非常に便利なのだけれど。

Eclipse Callisto Project
http://www.eclipse.org/callisto/
Callisto Update Site
http://download.eclipse.org/callisto/releases/
Eclipse V3.2 Callisto では何がホットなのか
http://www-06.ibm.com/jp/developerworks/opensource/library/os-ecl-callisto/index.shtml

Posted in Misc | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 09, 2007

[Misc] Apache Struts Platform Requirements

Apache Struts の動作環境をまとめてみた。 まとまった資料が見つからなかったので。

Servlet JSP J2SE(Java SE)
Apache Struts 2.0.x 2.4 ~ 2.0 ~ 5.0 ~
Apache Struts 1.3.x 2.3 ~ 1.2 ~ 1.4 ~
Apache Struts 1.2.x 2.2 ~ 1.1 ~ 1.3 ~
Apache Struts 1.1.x 2.2 ~ 1.1 ~ 1.3 ~
Apache Struts 1.0.x 2.2 ~ 1.1 ~ 1.2 ~
Posted in Misc | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 08, 2007

[Misc] Apache Struts Release Notes

Apache Struts のリリースノートは結構仕事で参照するのだけれど、 場所が分かりづらくていつも右往左往する。というわけで、とりあえずメモ。・・・と言っても、新しいバージョンがリリースされたらまた URL が変わるのだろうな、この感じだと orz

2.0.x

2.0.5
http://struts.apache.org/2.0.5/docs/release-notes-205.html
2.0.4
http://struts.apache.org/2.0.5/docs/release-notes-204.html
2.0.3
http://struts.apache.org/2.0.5/docs/release-notes-203.html
2.0.2
http://struts.apache.org/2.0.5/docs/release-notes-202.html
2.0.1
http://struts.apache.org/2.0.5/docs/release-notes-201.html
2.0.0
http://struts.apache.org/2.0.5/docs/release-notes-200.html

1.3.x

1.3.5
http://struts.apache.org/1.3.5/userGuide/release-notes.html
1.3.3
http://struts.apache.org/1.3.5/userGuide/release-notes-1_3_3.html
1.3.2
http://struts.apache.org/1.3.5/userGuide/release-notes-1_3_2.html
1.3.1
http://struts.apache.org/1.3.5/userGuide/release-notes-1_3_1.html

1.2.x

1.2.9
http://struts.apache.org/1.2.9/userGuide/release-notes.html
1.2.8
http://struts.apache.org/1.2.9/userGuide/release-notes-1.2.8.html
1.2.7
http://struts.apache.org/1.2.9/userGuide/release-notes-1.2.7.html
1.2.4
http://struts.apache.org/1.2.9/userGuide/release-notes-1.2.4.html

1.1.x

1.1
http://struts.apache.org/1.1/userGuide/release-notes-1.1.html
1.1 RC2
http://struts.apache.org/1.1/userGuide/release-notes-1.1-rc2.html
1.1 RC1
http://struts.apache.org/1.1/userGuide/release-notes-1.1-rc1.html
1.1 b2
http://struts.apache.org/1.1/userGuide/release-notes-1.1-b2.html

1.0.x

1.0.2
http://struts.apache.org/1.0.2/release-notes-1.0.2.html
1.0.1
http://struts.apache.org/1.0.2/release-notes-1.0.1.html
1.0
http://struts.apache.org/1.0.2/release-notes-1.0.html
1.0 b3
http://struts.apache.org/1.0.2/release-notes-1.0-b3.html
1.0 b2
http://struts.apache.org/1.0.2/release-notes-1.0-b2.html
1.0 b1
http://struts.apache.org/1.0.2/release-notes-1.0-b1.html
Posted in Misc | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 06, 2007

[Misc] J2EE (Java EE) を構成する仕様一覧

J2EE (Java EE) は複数の仕様で構成されているが、Java EE 5 まで来ると仕様が多すぎる && 仕様のバージョンアップが入り乱れているといった理由で非常に憶えづらい。 というわけで、一度整理してみた。

Java EE 5 Technologies
http://java.sun.com/javaee/technologies/
J2EE 1.4 Document
http://java.sun.com/j2ee/1.4/docs/index.html
J2EE 1.3_01 Release Notes
http://java.sun.com/j2ee/sdk_1.3/1.3_01/techdocs/release/ReleaseNotes.html
J2EE 1.2.1 Release Notes
http://java.sun.com/j2ee/sdk_1.2.1/techdocs/release/ReleaseNotes.html

J2EE (Java EE) を構成する仕様一覧

Java EE 5
  • Web Services Technologies
    • Implementing Enterprise Web Services (JSR 109)
    • Java API for XML-Based Web Services (JAX-WS) 2.0 (JSR 224)
    • Java API for XML-Based RPC (JAX-RPC) 1.1 (JSR 101)
    • Java Architecture for XML Binding (JAXB) 2.0 (JSR 222)
    • SOAP with Attachments API for Java (SAAJ) (JSR 67)
    • Streaming API for XML (JSR 173)
    • Web Service Metadata for the Java Platform (JSR 181)
  • Web Application Technologies
    • Java Servlet 2.5 (JSR 154)
    • JavaServer Faces 1.2 (JSR 252)
    • JavaServer Pages 2.1 (JSR 245)
    • JavaServer Pages Standard Tag Library (JSR 52)
  • Enterprise Application Technologies
    • Enterprise JavaBeans 3.0 (JSR 220)
    • J2EE Connector Architecture 1.5 (JSR 112)
    • Common Annotations for the Java Platform (JSR 250)
    • Java Message Service API (JSR 914)
    • Java Persistence API (JSR 220)
    • Java Transaction API (JTA) (JSR 907)
    • JavaBeans Activation Framework (JAF) 1.1 (JSR 925)
    • JavaMail (JSR 919)
  • Management and Security Technologies
    • J2EE Application Deployment (JSR 88)
    • J2EE Management (JSR 77)
    • Java Authorization Contract for Containers (JSR 115)
J2EE 1.4
  • J2EE Connector Specification 1.5
  • J2EE Deployment API Specification 1.1
  • J2EE Management Specification 1.0
  • Enterprise JavaBeans Specification 2.1
  • Enterprise JavaBeans to CORBA Mapping 1.1
  • Java API for XML Processing Specification 1.2
  • Java API for XML Registries Specification 1.0
  • Java API for XML-based RPC Specification 1.1
  • Java Authorization Contract for Containers 1.0
  • Java IDL API
  • Java Naming and Directory Interface Specification 1.2.1
  • Java Message Service Specification 1.1
  • Java Servlet Specification 2.4
  • Java Transaction API Specification 1.0.1B
  • Java Transaction Service Specification 1.0
  • JDBC Specifications, 3.0, 2.1, and Optional Package API (2.0)
  • JavaBeans Activation Framework Specification 1.0.2
  • JavaMail API Specification 1.3
  • JavaServer Pages Specification 2.0
  • RMI over IIOP
  • SOAP with Attachments API for Java Specification 1.2
J2EE 1.3_01
  • HTTP and HTTPS
  • COS naming
  • Enterprise JavaBeansTM (EJB) 2.0
  • JavaTM Servlets 2.3
  • JavaServer PagesTM (JSP) 1.2
  • JavaTM Messaging Service (JMS) 1.0.2
  • J2EETM Connector 1.0
  • JDBCTM Standard Extension 2.0
  • JavaTM Transaction API (JTA) 1.0
  • JavaMailTM 1.2
  • JavaTM API for XML Parsing (JAXP) 1.1
J2EE 1.2.1
  • Enterprise JavaBeansTM API, v. 1.1
  • JavaTM Servlets, v. 2.2
  • JavaServer PagesTM technology, v. 1.1
  • JDBCTM Standard Extension, v. 2.0
  • Java Naming and Directory InterfaceTM API, v. 1.2 (CosNaming SPI)
  • RMI/IIOP
  • JavaTM Transaction API, v. 1.0
  • JavaMailTM API, v. 1.1
  • JavaTM Messaging Service, v. 1.0 (API only, no implementation)
Posted in Misc | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |

Feb 01, 2007

[Misc] Google Mini がやってきた

と言っても自宅にではなくて会社に。当然か。 以前プロジェクトで導入したいと思ったことがあったのだけれど、そのときは未だ日本法人で取り扱っていなくて断念。
先日ふと会社のマシンルームに入ってみると、見慣れない筐体が。 しかも、Google と書いてある。
[Google Mini] [Google Mini] [Google Mini]

早速担当の人に声をかけて少し遊ばせてもらった。 まだ国内では導入実績が少ないのか色々問題含みではあるようだが、なかなか面白い。 小規模検索なら、コストパフォーマンスも性能も良いので、一つの選択肢にはなるだろう。
[Google Mini]

後、オマケで Google Mini T シャツが付いてきたのも結構嬉しい。
[Google Mini] [Google Mini]

Google Mini
http://www.google.co.jp/enterprise/mini/

Posted in Misc | このエントリーをはてなブックマークに追加 | この記事をクリップ! livedoor クリップ |