Powershell-Misc icon indicating copy to clipboard operation
Powershell-Misc copied to clipboard

An invalid parameter was passed to a service or function

Open remcovergoossen opened this issue 4 years ago • 2 comments
trafficstars

"MSATEST" | use-serviceaccount -add -> gives "An invalid parameter was passed to a service or function."

Other commands work and give the required output.

remcovergoossen avatar Aug 13 '21 08:08 remcovergoossen

The -Add parameter uses NetAddServiceAccount and this error message comes directly from it.

I'll need more details to debug this:

  1. Please run the commands below and share the result:
    • 'MSATEST' | Use-ServiceAccount -Add -Verbose
    • 'MSATEST' | Use-ServiceAccount -Query -Verbose
  2. What Windows and PowerShell versions are you using?
    • Run ver.exe from cmd
    • Run $PSVersionTable in your PowerShell
  3. Is MSATEST a standalone managed service account (sMSA) or group managed service account (gMSA)?

beatcracker avatar Aug 13 '21 21:08 beatcracker

Hi, thanks for your reply, please see below.

MSATEST' | Use-ServiceAccount -Add -Verbose

$SQLInstall.ServiceAccountName | Use-ServiceAccount -Add -Verbose

VERBOSE: Using account: MSASQL999TI01VERBOSE: Installing account using NetAddServiceAccountVERBOSE: Returning user-friendly error message for status code: 3221225485Use-ServiceAccount : An invalid parameter was passed to a service or function.At line:1 char:34+ $SQLInstall.ServiceAccountName | Use-ServiceAccount -Add -Verbose+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,

$SQLInstall.ServiceAccountName | Use-ServiceAccount -Query -Verbose

  • VERBOSE: Using account: MSASQL999TI01
  • VERBOSE: Querying account detail using NetQueryServiceAccount
  • WARNING: The Managed Service Account MSASQL999TI01 is not linked with any computer object in the directory.
  • False

PSVersion 5.1.17763.2090 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.2090 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

ver: Microsoft Windows [Version 10.0.17763.2114]

(g)MSA? The account is a Managed Service Account

On Fri, 13 Aug 2021 at 23:10, beatcracker @.***> wrote:

The -Add parameter uses NetAddServiceAccount https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/nf-lmaccess-netaddserviceaccount and this error message comes directly from it.

I'll need more details to debug this:

  1. Please run the commands below and share the result:
    • 'MSATEST' | Use-ServiceAccount -Add -Verbose
    • 'MSATEST' | Use-ServiceAccount -Query -Verbose
  2. What Windows and PowerShell versions are you using?
    • Run ver.exe from cmd
    • Run $PSVersionTable in your PowerShell
  3. Is MSATEST a standalone managed service account (sMSA) or group managed service account (gMSA)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beatcracker/Powershell-Misc/issues/4#issuecomment-898722084, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHRCB5PHM2CFGD7AZ3FUBRTT4WC4LANCNFSM5CDC2C2A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

remcovergoossen avatar Aug 16 '21 13:08 remcovergoossen