PowerShell question for 70-640

LunchbocksLunchbocks Member Posts: 319 ■■■■□□□□□□
I have a question regarding the difference in PowerShell between W2K8 and W2K8 R2. When studying for the 70-640 before R2, the commands were different than what they are showing now in the R2 book. For instance, creating a user account started with:
$ou=[ADSI] "LDAP://ou= phoenix,dc=contoso,dc=com"
had 2 other lines, and then ended with:
$newuser.SetInfo().

The R2 version of the book shows it as simply: New-ADUser -path "ou=phoenix,dc=contoso,dc=com" -Name "Joe User" -sAMAccountName "Joe.User".

Have I missed something, or has PowerShell changed that much?

Thanks,
Degree: Liberty University - B.S Computer Science (In Progress)
Current Certs: CCENT | MCTS | Network+
Currently Working On: Security+
2020 Goals: CCNA, CCNP Security, Linux+


Comments

  • ParthetParthet Registered Users Posts: 3 ■□□□□□□□□□
    I don't know about the non-R2 version because I started studying strictly the R2 books, but everything within Powershell is done with commandlets now (IE New-ADUser, Get-ADUser, Set-ADGroup, New-ADGroup, etc.)
  • LunchbocksLunchbocks Member Posts: 319 ■■■■□□□□□□
    The new way using cmdlets is much easier. To add a user before using PowerShell, you would have to type the following:

    $objOU = [ADSI]"LDAP://localhost:389/ou=HR,dc=NA,dc=fabrikam,dc=com"
    $objUser = $objOU.Create("user", "cn=MyerKen")
    $objUser.Put("sAMAccountName", "myerken")
    $objUser.SetInfo()

    Now it seems to be a single "NewADUser" cmdlet. I just wanted to make sure that I wasn't missing something, and that the test won't reference the old way.

    Thanks,
    Degree: Liberty University - B.S Computer Science (In Progress)
    Current Certs: CCENT | MCTS | Network+
    Currently Working On: Security+
    2020 Goals: CCNA, CCNP Security, Linux+


  • jmritenourjmritenour Member Posts: 565
    Yes, powershell 2.0 (R2 & Win 7) is a huge leap forward from 1.0 (2008 & Vista). Much more usable, and powerful.
    "Start by doing what is necessary, then do what is possible; suddenly, you are doing the impossible." - St. Francis of Assisi
  • ParthetParthet Registered Users Posts: 3 ■□□□□□□□□□
    I can assure you that the test will only use the new Cmdlet syntax for any references to Powershell. Keep in mind there are a lot of other command-line commands that you need to know aside from Powershell. IE csvde, ldife, netdeom, ntdsutil, etc. In addition to powershell commands I would ensure that you are intimately close to all the command-line tools.
  • ptilsenptilsen Member Posts: 2,835 ■■■■■■■■■■
    You still need to make LDAP and WMI calls for some things, but 95% or more of what you'll ever need to do is provided by Cmdlet.

    The R2 tests focus pretty much exclusively on Cmdlet memorization. PowerShell syntax is not tested on, nor are LDAP calls.
    Working B.S., Computer Science
    Complete: 55/120 credits SPAN 201, LIT 100, ETHS 200, AP Lang, MATH 120, WRIT 231, ICS 140, MATH 215, ECON 202, ECON 201, ICS 141, MATH 210, LING 111, ICS 240
    In progress: CLEP US GOV,
    Next up: MATH 211, ECON 352, ICS 340
  • PsoasmanPsoasman Member Posts: 2,687 ■■■■■■■■■□
    I'd practice with things like enabling the AD Recycle Bin, creating users, working with Cert Services, etc.
  • LunchbocksLunchbocks Member Posts: 319 ■■■■□□□□□□
    Thanks guys. I was worried that I was missing something. I am weak in PowerShell, so I have some labbing to do with it. I feel like I am in pretty good shape with CSVDE and LDIFDE, and I actually like DSAdd, so that one comes pretty easy. Memorizing the cmdlets is a lot easier to me than memorizing the old way.
    Degree: Liberty University - B.S Computer Science (In Progress)
    Current Certs: CCENT | MCTS | Network+
    Currently Working On: Security+
    2020 Goals: CCNA, CCNP Security, Linux+


  • ParthetParthet Registered Users Posts: 3 ■□□□□□□□□□
    It certainly is. All the cmdlets are just action-object which makes it very easy to remember or at least sermise what you need if you forget. Plus I dont remember if the old way had autofill like R2 does. You can 'TAB' through the different cmdlets if you don't remember the exact one you need.
Sign In or Register to comment.