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 6820511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:26:00+00:00 2026-05-26T21:26:00+00:00

Ive been using a custom class for some time like this in PS (2.0):

  • 0

Ive been using a custom class for some time like this in PS (2.0):

import-module .\MyClassLib.dll

$task = New-Object MyClassLib.OracleScript -Property @{
                                                            Files="MyScript.sql" 
                                                            Database="TEST"
                                                            User="USER" 
                                                            Password="PASSWORD"  
                                                        }
$result = $task.Execute()

And this works just fine.

However i wanted to create a CmdLet in C# to do the work instead. So after creating the cmdlet i thought I could do one of the following:

Invoke-OracleScript @{
                            Files="Script.sql" 
                            Database="db"
                            User="user" 
                            Password="password"  
                           }

Invoke-OracleScript @{
                            Files="Script.sql"; 
                            Database="db";
                            User="user"; 
                            Password="password";  
                           }

Invoke-OracleScript -Property @{
                            Files="Script.sql"
                            Database="db"
                            User="user"
                            Password="password"  
                           }

But no luck. :(.

I keep getting errors like:

  • Cannot find the file System.Collections.Hashtable ( it thinks the entire hashtable is the Files parameter)
  • A parameter cannot be found that matches parameter name ‘Property’
  • And a couple more.

My Class:

[Cmdlet(VerbsLifecycle.Invoke, "OracleScript", ConfirmImpact = ConfirmImpact.High, SupportsShouldProcess = true, SupportsTransactions = false)]
public class Invoke_OracleScript : Cmdlet, IOracleScript
{
    [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
    public string Files { get; set; }

    [Parameter(Mandatory = true, Position = 1, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
    public string Database { get; set; }
    ....

If I instead use parameters like this: -Files “” -Database “”, it works just fine, but everything has to be on 1 line which is very bad for reading. So the hashtable is really my biggest wish :).

Can anyone explain to me what im missing here?
(ParameterSets?, a secret attribute i’ve been unable to find in the docs, other)

Kind regards

  • 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-05-26T21:26:01+00:00Added an answer on May 26, 2026 at 9:26 pm

    If all you care is to make the cmdlet call to be in multiple lines, you can use backtick (`) to extend the command to the next line:

    get-process -Name notepad `
                -Computername localhost `
                -Verbose
    

    Or, you can create custom object:

    $process = new-object psobject
    $process | add-member -name name -value notepad -type noteproperty
    $process | add-member -name computername -value localhost -type noteproperty
    $process | get-process
    

    Or, what you were doing:

    $process = new-object psobject -property @{ name="notepad";
                                                computername = "localhost";}
    
    $process | get-process
    

    I think hashtable as objects was a feature that was added in v3.0 ( currently in CTP)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using TortoiseSVN in a Windows environment for quite some time. It seems
I've been using some basic AOP style solutions for cross-cutting concerns like security, logging,
I've been trying to switch from using PerlSetEnv to using custom configuration directives .
I've been using tags in my projects. I was browsing the custom tags on
I've been using a lot of new .NET 3.5 features in the work that
This is my custom model binder code for the BaseContentObject class: public class BaseContentObjectCommonPropertiesBinder
I'm somewhat new to Python, Django, and I'd like some advice on how to
In the past few weeks I've been developing a custom PHP login class that
I've been using PHP & MySQL for ages and am about to start using
I've been using WatiN as a testing tool for my current project. Besides the

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.