Windows Vista Forums

Powershell "Net User" equivalent

  1. #1


    malckelly Guest

    Powershell "Net User" equivalent

    Is there an equivalent in powershell for doing



    "net user user1 /domain"

    or really just a "net user" command.

      My System SpecsSystem Spec

  2. #2


    Marco Shaw [MVP] Guest

    Re: Powershell "Net User" equivalent

    malckelly wrote:

    > Is there an equivalent in powershell for doing
    >
    > "net user user1 /domain"
    >
    > or really just a "net user" command.
    What were you looking to do? You can just use "net user user1 /domain"
    from within PowerShell.

    The Quest AD cmdlets also provide a lot of information, and there's a
    free version:
    http://www.quest.com/powershell/

    Marco

    --
    Microsoft MVP - Windows PowerShell
    http://www.microsoft.com/mvp

    PowerGadgets MVP
    http://www.powergadgets.com/mvp

    Blog:
    http://marcoshaw.blogspot.com

      My System SpecsSystem Spec

  3. #3


    Brandon Shell [MVP] Guest

    Re: Powershell "Net User" equivalent

    You can use net.exe you can also use .NET but its a little more involved
    than net.exe.

    If your interested I will post some examples.

    "malckelly" <malckelly@xxxxxx> wrote in message
    news:90D1F7A8-98D7-4DD8-9C83-0B920CB2B684@xxxxxx

    > Is there an equivalent in powershell for doing
    >
    > "net user user1 /domain"
    >
    > or really just a "net user" command.

      My System SpecsSystem Spec

  4. #4


    malckelly Guest

    Re: Powershell "Net User" equivalent

    It was really a powershell equivalent that passes out the result as an
    object. At the moment I have to parse the output with regex and I just think
    there must be an easier way.

    "Marco Shaw [MVP]" wrote:

    > malckelly wrote:

    > > Is there an equivalent in powershell for doing
    > >
    > > "net user user1 /domain"
    > >
    > > or really just a "net user" command.
    >
    > What were you looking to do? You can just use "net user user1 /domain"
    > from within PowerShell.
    >
    > The Quest AD cmdlets also provide a lot of information, and there's a
    > free version:
    > http://www.quest.com/powershell/
    >
    > Marco
    >
    > --
    > Microsoft MVP - Windows PowerShell
    > http://www.microsoft.com/mvp
    >
    > PowerGadgets MVP
    > http://www.powergadgets.com/mvp
    >
    > Blog:
    > http://marcoshaw.blogspot.com
    >

      My System SpecsSystem Spec

  5. #5


    malckelly Guest

    Re: Powershell "Net User" equivalent

    Like I said to Marco it was really just some kind of command that would
    return the result as an object so that it could be handled easier. At the
    moment I have to user Regex to gather specific information.

    "Brandon Shell [MVP]" wrote:

    > You can use net.exe you can also use .NET but its a little more involved
    > than net.exe.
    >
    > If your interested I will post some examples.
    >
    > "malckelly" <malckelly@xxxxxx> wrote in message
    > news:90D1F7A8-98D7-4DD8-9C83-0B920CB2B684@xxxxxx

    > > Is there an equivalent in powershell for doing
    > >
    > > "net user user1 /domain"
    > >
    > > or really just a "net user" command.
    >

      My System SpecsSystem Spec

  6. #6


    Marco Shaw [MVP] Guest

    Re: Powershell "Net User" equivalent

    malckelly wrote:

    > It was really a powershell equivalent that passes out the result as an
    > object. At the moment I have to parse the output with regex and I just think
    > there must be an easier way.
    Try the Quest cmdlets, otherwise Brandon has a lot of AD
    experience/knowledge.

    Example (using the 2.0 CTP):

    PSH> get-qaduser foo_user|get-member -force|select name

    (Don't use "-force" with PSH 1.0)

    Name
    ----
    pstypenames
    psadapted
    psbase
    psextended
    psobject
    PsStandardMembers
    Close
    Equals
    GetHashCode
    GetPropertyValue
    GetType
    get_CanonicalName
    get_City
    get_Company
    get_ConnectionParameters
    get_CreationDate
    get_Department
    get_Description
    get_DirectoryEntry
    get_DisplayName
    get_DN
    get_Email
    get_Fax
    get_FirstName
    get_Guid
    get_HomePhone
    get_Initials
    get_IsOpen
    get_Item
    get_LastName
    get_LogonName
    get_Manager
    get_MemberOf
    get_MobilePhone
    get_ModificationDate
    get_Name
    get_NetworkCredential
    get_Notes
    get_Office
    get_Pager
    get_ParentContainer
    get_PhoneNumber
    get_PostalCode
    get_PostOfficeBox
    get_Sid
    get_StateOrProvince
    get_StreetAddress
    get_Title
    get_Type
    get_UserPrincipalName
    get_WebPage
    Open
    RefreshCache
    ToString
    accountExpires
    badPasswordTime
    badPwdCount
    cn
    co
    codePage
    countryCode
    distinguishedName
    dSCorePropagationData
    employeeID
    givenName
    homeMDB
    homeMTA
    instanceType
    l
    lastLogoff
    lastLogon
    lastLogonTimestamp
    legacyExchangeDN
    lockoutTime
    logonCount
    logonHours
    mail
    mailNickname
    managedObjects
    mDBUseDefaults
    mobile
    msExchALObjectVersion
    msExchHomeServerName
    msExchMailboxGuid
    msExchMailboxSecurityDescriptor
    msExchPoliciesIncluded
    msExchUserAccountControl
    mSMQDigests
    mSMQSignCertificates
    msRTCSIP-ArchivingEnabled
    msRTCSIP-FederationEnabled
    msRTCSIP-InternetAccessEnabled
    msRTCSIP-IsMaster
    msRTCSIP-PrimaryHomeServer
    msRTCSIP-PrimaryUserAddress
    msRTCSIP-UserEnabled
    nTSecurityDescriptor
    o
    objectCategory
    objectClass
    objectGUID
    objectSid
    primaryGroupID
    proxyAddresses
    pwdLastSet
    sAMAccountName
    sAMAccountType
    scriptPath
    showInAddressBook
    sn
    st
    telephoneNumber
    textEncodedORAddress
    userAccountControl
    uSNChanged
    uSNCreated
    whenChanged
    whenCreated
    Item
    CanonicalName
    City
    Company
    ConnectionParameters
    CreationDate
    Department
    Description
    DirectoryEntry
    DisplayName
    DN
    Email
    Fax
    FirstName
    Guid
    HomePhone
    Initials
    IsOpen
    LastName
    LogonName
    Manager
    MemberOf
    MobilePhone
    ModificationDate
    Name
    NetworkCredential
    Notes
    Office
    Pager
    ParentContainer
    PhoneNumber
    PostalCode
    PostOfficeBox
    Sid
    StateOrProvince
    StreetAddress
    Title
    Type
    UserPrincipalName
    WebPage

      My System SpecsSystem Spec

  7. #7


    Brandon Shell [MVP] Guest

    Re: Powershell "Net User" equivalent

    Do you want local or domain accounts?

    for local you will need to use WMI or .NET
    for Domain you can use the free Quest CMDLets or .NET

    Brandon Shell
    ---------------
    Blog: http://www.bsonposh.com/
    PSH Scripts Project: www.codeplex.com/psobject

    m> It was really a powershell equivalent that passes out the result as
    m> an object. At the moment I have to parse the output with regex and I
    m> just think there must be an easier way.
    m>
    m> "Marco Shaw [MVP]" wrote:
    m>

    >> malckelly wrote:
    >>

    >>> Is there an equivalent in powershell for doing
    >>>
    >>> "net user user1 /domain"
    >>>
    >>> or really just a "net user" command.
    >>>
    >> What were you looking to do? You can just use "net user user1
    >> /domain" from within PowerShell.
    >>
    >> The Quest AD cmdlets also provide a lot of information, and there's a
    >> free version:
    >> http://www.quest.com/powershell/
    >> Marco
    >>
    >> --
    >> Microsoft MVP - Windows PowerShell
    >> http://www.microsoft.com/mvp
    >> PowerGadgets MVP
    >> http://www.powergadgets.com/mvp
    >> Blog:
    >> http://marcoshaw.blogspot.com


      My System SpecsSystem Spec

  8. #8


    malckelly Guest

    Re: Powershell "Net User" equivalent

    It would be for domain users. Quest CMDlets I will go and investigate, but
    it would be nicer if it was something that was included in powershell. (I
    don't know about you but I feel like I am forever installing bolt-ons for
    psh). Any idea if there is going to be anything like this in PSH2?

    What's the .Net option?

    Much appreciated

    "Brandon Shell [MVP]" wrote:

    > Do you want local or domain accounts?
    >
    > for local you will need to use WMI or .NET
    > for Domain you can use the free Quest CMDLets or .NET
    >
    > Brandon Shell
    > ---------------
    > Blog: http://www.bsonposh.com/
    > PSH Scripts Project: www.codeplex.com/psobject
    >
    > m> It was really a powershell equivalent that passes out the result as
    > m> an object. At the moment I have to parse the output with regex and I
    > m> just think there must be an easier way.
    > m>
    > m> "Marco Shaw [MVP]" wrote:
    > m>

    > >> malckelly wrote:
    > >>
    > >>> Is there an equivalent in powershell for doing
    > >>>
    > >>> "net user user1 /domain"
    > >>>
    > >>> or really just a "net user" command.
    > >>>
    > >> What were you looking to do? You can just use "net user user1
    > >> /domain" from within PowerShell.
    > >>
    > >> The Quest AD cmdlets also provide a lot of information, and there's a
    > >> free version:
    > >> http://www.quest.com/powershell/
    > >> Marco
    > >>
    > >> --
    > >> Microsoft MVP - Windows PowerShell
    > >> http://www.microsoft.com/mvp
    > >> PowerGadgets MVP
    > >> http://www.powergadgets.com/mvp
    > >> Blog:
    > >> http://marcoshaw.blogspot.com
    >
    >
    >

      My System SpecsSystem Spec

  9. #9


    Brandon Shell [MVP] Guest

    Re: Powershell "Net User" equivalent

    You can use this

    function Get-ADUsers{
    Param($Dom)
    if($Dom){$Dom = [ADSI]"LDAP://$dom"}else{$Dom = [ADSI]""}
    $filter = "(&(objectcategory=user))"
    $searcher = New-Object System.DirectoryServices.DirectorySearcher($Dom,$filter)
    $searcher.pagesize = 1000
    $searcher.findall()
    }

    Q: Any idea if there is going to be anything like this in PSH2?
    A: I may be off base here, but my general feeling on this is the Powershell
    Team is not going to provide this functionality and to be honest I agree
    with that decision. IMO the Powershell team is directly responsible for the
    Powershell framework and base CMDLets. Extenstions should be provided by
    "Internal Third Party Teams" ie Exchange,Active Directory,SMS, MOM, and Office.
    Treating internal products like external third party products is great. It
    allows the Powershell team to focus on the actual functionality of Powershell
    itself.

    Brandon Shell
    ---------------
    Blog: http://www.bsonposh.com/
    PSH Scripts Project: www.codeplex.com/psobject

    m> It would be for domain users. Quest CMDlets I will go and
    m> investigate, but it would be nicer if it was something that was
    m> included in powershell. (I don't know about you but I feel like I am
    m> forever installing bolt-ons for psh). Any idea if there is going to
    m> be anything like this in PSH2?
    m>
    m> What's the .Net option?
    m>
    m> Much appreciated
    m>
    m> "Brandon Shell [MVP]" wrote:
    m>

    >> Do you want local or domain accounts?
    >>
    >> for local you will need to use WMI or .NET
    >> for Domain you can use the free Quest CMDLets or .NET
    >> Brandon Shell
    >> ---------------
    >> Blog: http://www.bsonposh.com/
    >> PSH Scripts Project: www.codeplex.com/psobject
    >> m> It was really a powershell equivalent that passes out the result
    >> as
    >> m> an object. At the moment I have to parse the output with regex
    >> and I
    >> m> just think there must be an easier way.
    >> m>
    >> m> "Marco Shaw [MVP]" wrote:
    >> m>

    >>>> malckelly wrote:
    >>>>
    >>>>> Is there an equivalent in powershell for doing
    >>>>>
    >>>>> "net user user1 /domain"
    >>>>>
    >>>>> or really just a "net user" command.
    >>>>>
    >>>> What were you looking to do? You can just use "net user user1
    >>>> /domain" from within PowerShell.
    >>>>
    >>>> The Quest AD cmdlets also provide a lot of information, and there's
    >>>> a
    >>>> free version:
    >>>> http://www.quest.com/powershell/
    >>>> Marco
    >>>> --
    >>>> Microsoft MVP - Windows PowerShell
    >>>> http://www.microsoft.com/mvp
    >>>> PowerGadgets MVP
    >>>> http://www.powergadgets.com/mvp
    >>>> Blog:
    >>>> http://marcoshaw.blogspot.com


      My System SpecsSystem Spec

  10. #10


    Karl Prosser[MVP] Guest

    Re: Powershell "Net User" equivalent

    malckelly wrote:

    > It would be for domain users. Quest CMDlets I will go and investigate, but
    > it would be nicer if it was something that was included in powershell. (I
    > don't know about you but I feel like I am forever installing bolt-ons for
    > psh).
    I think the bolt-on thing is by design.. MS does provide some ADSI
    functionality built into powershell but really that is an odd fit, in
    the future it will be a bolt-on from the active directory team i
    suppose, and almost all other things will be a bolt-on for the
    particular product akin to exchange for now. It would default the
    purpose of powershell ,as a language and a base platform, to try to put
    all functionality inside powershell itself, i think there is a
    philosophical point here, but feel free to disagree

    one good thing about powershell being built on the dotnet framework is
    that you have a HUGE premade, prerequisite bolt-on already there. If it
    wasn't for that, i think i'd be depending on an awful lot more snapins.

    Karl
    http://www.powershell.com


      My System SpecsSystem Spec

Page 1 of 2 12 LastLast
Powershell "Net User" equivalent

Similar Threads
Thread Thread Starter Forum Replies Last Post
is there an equivalent Function to FORMAT(56,"0000") magellan VB Script 9 24 Dec 2008
Solved Can't access "Network and Sharing Center" nor "User Accounts" newbie General Discussion 16 18 Oct 2008
Vista's equivalent of "My Network places"? Michael Moser Vista networking & sharing 2 31 Aug 2008
powershell equivalent of "DIR \\server\path /A:D /S /B" Ben Christian PowerShell 14 10 Mar 2008
Is there an equivalent of the DOS shell "start /wait" in PowerShel Brillig PowerShell 6 20 Jan 2007