Nice programing

PowerShell을 시작하는 방법은 무엇입니까?

nicepro 2020. 11. 11. 20:38
반응형

PowerShell을 시작하는 방법은 무엇입니까?


PowerShell V1의 초기 베타 버전 중 하나를 사용했지만 "골드"가 된 이후로는 사용하지 않았습니다. PowerShell 사용을 시작하는 가장 좋은 방법은 무엇입니까?

어떤 버전의 PowerShell을 사용해야합니까 (V1.0 vs 2.0 CTP)? PowerShell을 사용하는 용도는 무엇입니까? PowerShell을 더 쉽게 사용할 수있는 도구가 있습니까 (즉, 개발 환경)?


PowerShell을 배우기위한 많은 훌륭한 리소스가 있습니다.

  1. Technet Virtual Labs ( Windows PowerShell 소개 )
  2. PowerShellCommunity.org-포럼, 블로그, 스크립트 저장소
  3. irc.freenode.net의 powershell

  4. PowerShell 팟 캐스트-PowerScripting.net 및 Get-Scripting.blogspot.com

IDE 스타일 환경의 경우 PowerShell Analyzer (무료) 및 PowerGUI (무료), PowerShell Plus (상용), PrimalScript (상용) 및 Admin Script Editor (상용)가 있습니다.

가능한 모든 작업에 PowerShell을 사용합니다. 지금 은 PowerShell 기반 빌드 스크립트 환경 인 Psake를 살펴보고 있습니다. 내 Active Directory, Hyper-V, Twitter, 일부 키보드 자동화 (키 입력을 잡기 위해 winforms 앱에서 PowerShell 호스팅) 및 기타 많은 항목을 관리하는 데 if를 사용합니다. 확인해야 할 또 다른 멋진 프로젝트는 테스트 용 PSExpect 입니다. 나는 또한 데이터베이스 액세스를 위해 그것을 사용합니다-응용 프로그램에 의해 데이터베이스의 행에 대한 변경 사항을 모니터링합니다. 내 네트워크 모니터링 솔루션에도 통합되어 있습니다.

또한 작업중인 프로젝트의 스크립팅 엔진으로 PowerShell을 사용하려고합니다.

편집 : PowerShell을 배우는 경우 V1에 집중할 것입니다. 더 편 해지면 CTP를 살펴 보지만 너무 많이 CTP에서 실제로 V2로 출시 된 것으로 변경되어 학습 도구가 될 수 있습니다. 버전 2는 XP SP3, Server 2003, Vista 및 Server 2008과 Win7 및 Server 2008 R2의 경우 기본 제공됩니다. V1에서 배운 내용은 여전히 ​​잘 작동하지만, 이제는 우수한 기능 세트가 있으므로 V2에 집중하겠습니다.

행운을 빕니다!


질문에 하나씩 대답합니다.

v2.0의 CTP를 받으세요. 나는 1.0과 2.0을 사용했고 이후 버전에서 안정성 문제를 발견하지 못했고 더 많은 기능을 가지고 있습니다 .

시작하는 가장 좋은 방법은 세 가지 기본 명령 을 배우고 이를 사용하여 시작하는 것입니다.

1 단계-Get-Command를 사용하여 사용 가능한 명령 검색

예를 들어 모든 "get"명령을 찾으려면 다음을 입력하면됩니다.

* Get-Command get **

예를 들어 모든 "set"명령을 찾으려면 다음을 입력하면됩니다.

* Get-Command 세트 **

2 단계-Get-Help를 사용하여 각 명령을 사용하는 방법 알아보기

Get-Command 커맨드 렛 유형에 대한 기본 도움말을 보려면 :

Get-Help Get-Command

추가 정보 유형을 얻으려면 :

Get-Help Get-Command -full

3 단계-Get-Member를 사용하여 개체 속성 및 메서드 검색

Powershell은 객체 지향 스크립팅 언어입니다. 모든 것은 속성과 메서드가있는 완전한 .Net 객체입니다.

예를 들어 Get-Process 커맨드 렛 유형에서 내 보낸 개체의 속성과 메서드를 가져 오려면

Get-Process | 회원 가입

파이프 및 정규식과 같이 이해해야하는 몇 가지 다른 개념이 있지만 이미 스크립팅을 수행 한 경우 익숙 할 것입니다.

무엇을 위해 사용하고 있습니까?

두가지:

  1. 대규모 분산 그리드 애플리케이션에서 로그 파일 처리. 이를 위해 그것은 믿을 수 없을 정도로 가치 있고 강력한 것으로 입증되었습니다.
  2. .Net 클래스의 빠른 테스트.

예를 들어 여러 가지 PowerShell 도구가 있습니다.

Powershell 팀 에는 블로그가 있습니다.


방금 Windows PowerShell 블로그에서 링크 된이 무료 eBook을 찾았습니다.

PowerShell 마스터하기


해결하는 데 필요한 문제를 찾아 앉아서 해결 될 때까지 PowerShell을 사용하여 해결하세요.

Don't give in and do it another way. Then find another, and another, etc. You'll take WAY longer at the start, but you'll be building knowledge to use going forward. As well as a script library to pull from for the future. One day you'll turn around and realize you now "know" PowerShell.

It's awesome. :)


Count me in with a vote for PowerShell in Action. There are a bunch of blogs out there as well, check out //\O//'s blog, The Huddled Masses, and JB's Powershell (SQL) as well, they go way back with the shell and have gobs of good scripts & snippets to look at.


Check PowerGUI, a PowerShell GUI and script editor. I don't use it yet, but I saw the sample videos and looks very good. Also, the site mantains a library with sample scripts.

Here is another excellent PowerShell reference.


The Ars Technica tutorial is a bit dated, but very good to get you up-and-running with PowerShell.

I would also second the suggestion to check out PowerGUI.


The PowerShell CTP is NOT supported in a production environment and a lot will change between now and the time it ships. I suggest following the many PowerShell blogs (don't forget the PowerScripting podcast). There's no shortage of good books on the topic. If you want to spend a little money, SAPIEN Technologies has some self-paced learning material at www.scriptingoutpost.com. I believe Don Jones has done a series of training videos for CBT Nuggets. You can probably find out more at concentratedtechnology.com.


I think getting into the habit of automating small tasks is a great way to train yourself in PowerShell. For example, writing a throwaway script rather than doing an onerous looking bit of text-processing by hand. It may actually take longer the first few times, but as you get quicker and build up a library of useful snippets that you can chain together you can save yourself a lot of time.


There are DNRtvs on PowerShell and PowerGUI. There are also .NET Rocks! episodes about these tools.


A chap called Guy Thomas does some good introductions to PowerShell.


I would start it on the fly. What I mean by on-the-fly is that just start to work on your real case and search for help on the web or this site for help if you don't know what to do. For sure, it will very beneficial if you spend some time to learn some basics first. This is what get on to PowerShell.

I have some blog posts on PowerShell, especially 3-serials on a real case I posted recently. Search for davidchuprogramming or go here. Good luck with your PowerShell journey.


PowerGUI was a big help in and of itself. The IntelliSense feature sold me on it, then I found some useful add-ons that were very good.

As far as resources:

Free eBooks:

  • Windows PowerShell Cookbook

  • Mastering PowerShell

  • PowerShell A more in-depth look

Introductory Video:

http://powergui.org/entry.jspa?externalID=2278&categoryID=361


With regard to the IDE question:

There is a rudimentary IDE which, on my computer at least, is already installed with PowerShell.

It's labeled "WindowsPowerShell ISE", and lets you do things like have several console sessions and several script files open simultaneously... one set of tabs for the scripts, one set for the console sessions, so you can click back and forth as needed.

참고URL : https://stackoverflow.com/questions/33559/how-to-get-started-with-powershell

반응형