List Startup folder contents, Server 2008

Welcome Forums General PowerShell Q&A List Startup folder contents, Server 2008

This topic contains 1 reply, has 2 voices, and was last updated by

3 years, 4 months ago.

  • Author
  • #29167

    Points: 0
    Rank: Member


    I am trying to get the contents of all users' Startup folders. I have created a small script that does this (below). The problem I ran into is that a few of the target servers are 2008 and do not have PS 3.0 or higher and does not seem to support applying a property by using the .PROPERTY method (Line 2, $allusers = $
    I would appreciate any help and thank you in advance.

    $users = get-childitem c:\users 
    $allusers = $
    foreach ($alluser in $users)
    	ls "c:\users\$alluser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
  • #29169

    Points: 1,124
    Helping Hand
    Rank: Community Hero

    Hi Santana,

    You can use the Select-Object cmdlet to select name and you can directly take the string by using the -ExpandProperty Parameter

    # $users = get-childitem c:\users 
    # $allusers = $
    $allusers = get-childitem c:\users | Select-Object  -ExpandProperty  Name
    foreach ($user in $allusers)
    	ls "c:\users\$user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"

The topic ‘List Startup folder contents, Server 2008’ is closed to new replies.