none
cannot convert system.object to the type system.string

    Question

  • Hi

    I've trying to set some registry values via powershell using:

    [xml]$userfile = Get-Content config.xml

    $domain = $userfile.config.domains.domain

    foreach( $hostname in $userfile.config.hostnames)

     set-location "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
     set-location ZoneMap\Domains
     set-location $domain
     new-item $hostname.hostname
     set-location $hostname.hostname
     new-itemproperty . -Name http -Value 2 -Type DWORD

    }

    The final set location fails with:

    cannot convert 'system.object' to the type 'system.string' required by paramater 'LiteralPath'

    What am I doing wrong?

    Thanks

    Mike

    Wednesday, July 27, 2011 5:15 PM

Answers

All replies