Data Masker from command line-PowerShell

Hello All,
I am trying to run the masking from the command line and replicated the same that shown in the video from the official website. I also added the path for "DataMaskerCmdLine" in the system variables. But still getting the below error.
Path: C:\Program Files\Red Gate\Data Masker for SQL Server 7
-------
& : The term 'C:\Program Files\Red Gate\Data Masker for SQL Server 7>DataMaskerCmdLine.exe' is not recognized as the name 
of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify 
that the path is correct and try again
--------

Thanks for the help!

Answers

  • Hi @Arun72 thank you for your post - can you please confirm the exact syntax you're running in powershell? 

    & runs an executable but it looks like your path includes an invalid character ">", it should be used like this:

    & "C:\Program Files\Red Gate\Data Masker for SQL Server 7\DataMaskerCmdLine.exe" PARFILE="C:\Users\arun72\Documents\Data Masker(SqlServer)\Masking Sets\MyParFile.PARFILE"

    Let me know if this helps,
    Kindest
  • Arun72Arun72 Posts: 21 Bronze 1
    HI @PlantBasedSQL

    Thanks for the response, the path was right ,but I entered it wrong in my previous post. I have tried multiple syntaxes, ran from command line as batch file and even the syntax that you suggested ,below is the error for both couple of syntaxes and I couldn't see any logs as well.

    Syntax 1:  & "C:\Program Files\Red Gate\Data Masker for SQL Server 7\DataMaskerCmdLine.exe" PARFILE="C:\Users\arun\Desktop\DataMasker\PowerShell\PARFILE.txt"

    Syntax 2: & "C:\Program Files\Red Gate\Data Masker for SQL Server 7\DataMaskerCmdLine.exe" PARFILE="C:\Users\arun\Desktop\DataMasker\PowerShell\PARFILE.PARFILE"

    Error:

    CmdLineMain: Starting
    CmdLineMain: Initializing...
    DMS_CmdLine.MaskingSetRunner: Error Processing Command Line: line 3 cannot be processed because it has an unknown keyword.
    CmdLineMain: Ending Exit Code=103

    PARFILE:
    MASKINGSET=C:\Users\arun\Desktop\Data Masker\MultipleSchemas.DMSMaskSet
    LOGFILEDIR=C:\Data\Data Masker(SqlServer)\Log Files
    DATASETDIR=C:\PROGRA~1\Red Gate\Data Masker for SQL Server 7\DataSets
    REPORTSDIR=C:\Data\Data Masker(SqlServer)\Reports
    INTERIM_REPORTS=true

    What should be the PARFILE format, I was using .txt but in your response I see its .PARFIL

    Thank you
  • Thanks @Arun72 It looks like Syntax 1 you have is correct but your DATASETDIR in the PARFILE might be the issue here, possibly if the cmdline isn't escaping the "~" in your directory, are you able to provide the full path at all or perhaps capture it in "''s?

    It can be .txt or .PARFILE (still basically a .txt though) but it sounds more like a PARFILE issue than a cmdline issue!
  • chkwokchkwok Posts: 1 New member
    It should be DATASETSDIR=C:\Program files\Red Gate\Data Masker for SQL Server 7\DataSets in PARFILE

    It's DATASETSDIR (Not DATASETDIR)
Sign In or Register to comment.