Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8053841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:58:38+00:00 2026-06-05T07:58:38+00:00

I am having some trouble with the code below. I am trying to figure

  • 0

I am having some trouble with the code below. I am trying to figure out how to get the output working for all user profiles instead of just the current user. If I use the $shell.NameSpace(34) the code works (the two lines commented out). But when I try override the shell.namespace and manually add the path I get an error that the method items does not exist. Wondering what the best way to fix or get around this issue is.

Actual error message: Method invocation failed because [System.String] doesn’t contain a method named ‘Items’.

Thanks for the help in advanced.

$shell = New-Object -ComObject Shell.Application
$colProfiles = Get-ChildItem "C:\Users\" -Name
#$hist = $shell.NameSpace(34)
#Write-Host $hist

foreach ( $userProfile in $colProfiles )
{
    [string]$hist = "C:\Users\$userProfile\AppData\Local\Microsoft\Windows\History"
    $date = ""
    $url = ""

    $hist.Items() | foreach {
        ""; ""; 
        if ($_.IsFolder) 
        {
            $siteFolder = $_.GetFolder
            $siteFolder.Items() | foreach {
                $site = $_
                ""; 
                if ($site.IsFolder) 
                {
                    $pageFolder  = $site.GetFolder
                    Write-Host $pageFolder
                    $pageFolder.Items() | foreach {
                        $url  = $pageFolder.GetDetailsOf($_,0)
                        $date = $pageFolder.GetDetailsOf($_,2)
                        echo "$date $url"
                    }
                }
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:58:41+00:00Added an answer on June 5, 2026 at 7:58 am

    According to the documentation you can create a namespace object from a path string.

    http://msdn.microsoft.com/en-us/library/windows/desktop/bb774085(v=vs.85).aspx

    So you can do this:

    $shell = New-Object -ComObject Shell.Application
    $colProfiles = Get-ChildItem "C:\Users\" -Name
    
    foreach ( $userProfile in $colProfiles )
    {
       [string] $histPath = "C:\Users\$userProfile\AppData\Local\Microsoft\Windows\History"
       $hist = $shell.NameSpace($histPath)
    
        $date = ""
        $url = ""
    
        $hist.Items() | foreach {
            ""; ""; 
            if ($_.IsFolder) 
            {
                $siteFolder = $_.GetFolder
                $siteFolder.Items() | foreach {
                    $site = $_
                    ""; 
                    if ($site.IsFolder) 
                    {
                        $pageFolder  = $site.GetFolder
                        Write-Host $pageFolder
                        $pageFolder.Items() | foreach {
                            $url  = $pageFolder.GetDetailsOf($_,0)
                            $date = $pageFolder.GetDetailsOf($_,2)
                            echo "$date $url"
                        }
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to understand the code below, and I'm having some trouble understanding why
I am having some trouble trying to checkout the BitSharp source code using SVN.
I'm trying to convert some Haskell code to F# but I'm having some trouble
I am having some trouble with a piece of code below: Input: li is
I'm having a little trouble with some code I'm writing. Basically, I'm trying to
Below is some code I'm having trouble with. Basically, I'm defining an empty array
I am having trouble figuring out what the code segment below is doing. It
I'm having some trouble trying to develop a regular expression which will pick out
Hi I've been having some trouble trying to get a list view I created
I'm trying to learn some javascript and i'm having trouble figuring out why my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.