{"id":23346359,"url":"https://github.com/tuckn/wshsmbconnector","last_synced_at":"2026-05-09T15:16:53.229Z","repository":{"id":39598814,"uuid":"266447029","full_name":"tuckn/WshSmbConnector","owner":"tuckn","description":"The WSH (Windows Script Host) CLI that connects to SMB resources according to the schema defined in a JSON file.","archived":false,"fork":false,"pushed_at":"2024-01-25T22:12:47.000Z","size":395,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T19:39:12.556Z","etag":null,"topics":["cli","jscript","json","schema","smb","windows","wsf","wsh"],"latest_commit_sha":null,"homepage":"https://tuckn.net/docs/WshSmbConnector/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuckn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tuckn"],"patreon":"tuckn","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-05-24T01:11:26.000Z","updated_at":"2024-06-27T09:33:16.000Z","dependencies_parsed_at":"2025-02-13T19:33:16.815Z","dependency_job_id":"826bb48b-8850-44ec-b2d0-372956951fb6","html_url":"https://github.com/tuckn/WshSmbConnector","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshSmbConnector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshSmbConnector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshSmbConnector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuckn%2FWshSmbConnector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuckn","download_url":"https://codeload.github.com/tuckn/WshSmbConnector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694882,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","jscript","json","schema","smb","windows","wsf","wsh"],"created_at":"2024-12-21T07:13:32.935Z","updated_at":"2026-05-09T15:16:48.209Z","avatar_url":"https://github.com/tuckn.png","language":"JavaScript","funding_links":["https://github.com/sponsors/tuckn","https://patreon.com/tuckn"],"categories":[],"sub_categories":[],"readme":"# WshSmbConnector\n\nThe WSH (Windows Script Host) CLI that connects to SMB resources according to the schema defined in a JSON file.\n\n## Operating environment\n\nWorks on JScript in Windows.\n\n## Installation\n\nDownload this ZIP and unzip or Use the following `git` command.\n\n```console\nD:\\\u003e git clone https://github.com/tuckn/WshSmbConnector.git\nD:\\\u003e cd WshSmbConnector\n```\n\nNow suppose your directory structure looks like this.\n\n```console\nD:\\WshSmbConnector\\\n  ├─ .wsh\\\n  │ └─ settings.json\n  └─ dist\\\n     ├─ Run.wsf\n     └─ bundle.js\n```\n\n## Usage\n\n### Write Schema JSON\n\nThe JSON default path to load is _%CD%\\.wsh\\\\settings.json_.\nSee _.\\\\.wsh\\\\settings.json_ as example.\n\nWrite your connection schema in the JSON file, for example,\n\n```json\n{\n  \"smbConnectorSchema\": {\n    \"tasks\": {\n      \"home\": {\n        \"comp\": \"11.22.33.44\",\n        \"share\": \"Public\",\n        \"user\": \"user1\",\n        \"pwd\": \"user p@ss\"\n      },\n      \"office\": {\n        \"comp\": \"SV12345\",\n        \"share\": \"IPC$\",\n        \"domain\": \"ID123456\",\n        \"user\": \"user1\",\n        \"pwd\": \"user p@ss\"\n      }\n    }\n  }\n}\n```\n\nYou can also define variables into `components` object.\nThe defined variable can be used as `${valName}` in `tasks`.\n\n```json\n{\n  \"smbConnectorSchema\": {\n    \"components\": {\n      \"myUser\": \"user1\",\n      \"myPass\": null\n    },\n    \"tasks\": {\n      \"home\": {\n        \"comp\": \"11.22.33.44\",\n        \"share\": \"Public\",\n        \"user\": \"${myUser}\",\n        \"pwd\": \"${myPass}\"\n      },\n      \"office\": {\n        \"comp\": \"SV12345\",\n        \"share\": \"IPC$\",\n        \"domain\": \"ID123456\",\n        \"user\": \"${myUser}\",\n        \"pwd\": \"${myPass}\"\n      }\n    }\n  }\n}\n```\n\nThe values specified as `null` in `components` must be specified CLI arguments.\n\n### Run with WSH\n\n```console\n\u003e cscript .\\dist\\Run.wsf schemaConnect * \"myPass:user p@ss\"\n```\n\n```console\n[2020-08-01T06:50:28] info    taskName: \"*\"\n[2020-08-01T06:50:28] info    matched tasks: 2\n[2020-08-01T06:50:28] info    Start the function smbcn.connectSyncSurelyUsingLog\n[2020-08-01T06:50:28] info    Start the task: home\n[2020-08-01T06:50:28] info    Connecting to \"11.22.33.44\"\n[2020-08-01T06:50:28] info    shareName: \"Public\"\n[2020-08-01T06:50:28] info    domain: \"\", user: \"user1\"\n[2020-08-01T06:50:28] info    password: \"****\"\n[2020-08-01T06:50:28] info    throws: false\n[2020-08-01T06:50:28] success Succeeded the connecting!\n[2020-08-01T06:50:28] info    Finished the function smbcn.connectSyncSurelyUsingLog\n[2020-08-01T06:50:28] info    Start the task: office\n[2020-08-01T06:50:28] info    Connecting to \"SV12345\"\n[2020-08-01T06:50:28] info    shareName: \"IPC$\"\n[2020-08-01T06:50:28] info    domain: \"ID123456\", user: \"user1\"\n[2020-08-01T06:50:28] info    password: \"****\"\n[2020-08-01T06:50:28] info    throws: false\n[2020-08-01T06:50:28] success Succeeded the connecting!\n[2020-08-01T06:50:28] info    Finished the function smbcn.connectSyncSurelyUsingLog\n```\n\nSpecify any tasks to run with property names.\n\n```console\n\u003e cscript .\\dist\\Run.wsf schemaConnect \"home\" \"myPass:user p@ss\"\n```\n\n```console\n[2020-08-01T06:50:28] info    taskName: \"home\"\n[2020-08-01T06:50:28] info    matched tasks: 1\n[2020-08-01T06:50:28] info    Start the function smbcn.connectSyncSurelyUsingLog\n[2020-08-01T06:50:28] info    Start the task: home\n[2020-08-01T06:50:28] info    Connecting to \"11.22.33.44\"\n[2020-08-01T06:50:28] info    shareName: \"Public\"\n[2020-08-01T06:50:28] info    domain: \"\", user: \"user1\"\n[2020-08-01T06:50:28] info    password: \"****\"\n[2020-08-01T06:50:28] info    throws: false\n[2020-08-01T06:50:28] success Succeeded the connecting!\n[2020-08-01T06:50:28] info    Finished the function smbcn.connectSyncSurelyUsingLog\n```\n\nShow the help.\n\n```console\n\u003e cscript .\\dist\\Run.wsf schemaConnect --help\n```\n\n```console\nUsage: schemaConnect \u003ctaskName\u003e [overwriteKey:val...] [options]\n\nThe command to connect a Windows to resources with the schema\n\nOptions:\n  -V, --version          Output the version number\n  -D, --dir-path \u003cpath\u003e  The path name where the schema JSON is located. \u003cDirectory Path\u003e or \"cwd\", \"portable\", \"userProfile\". Default: \"cmd\" is \"%CD%\\\\.wsh\"\n  -F, --file-name \u003cname\u003e A JSON file name. (default: \"settings.json\")\n  -E, --encoding \u003cname\u003e  The JSON file encoding. (default: \"utf-8\")\n  -N, --prop-name \u003cname\u003e A property name of the schema object. (default: \"smbConnectorSchema\")\n  -L, --logger \u003cval\u003e     \u003clevel\u003e/\u003ctransportation\u003e. e.g. \"warn/popup\".  (default: \"info/console\")\n  -H, --has-result       Show a result(net use) (default: false)\n  -R, --dry-run          No execute. Outputs the string of command. (default: false)\n  -h, --help             Output usage information\n```\n\nSee [Wsh.ConfigStore](https://tuckn.net/docs/WshConfigStore/) for the options `--dir-path` and `--file-name`.\nand see [Wsh.Logger](https://tuckn.net/docs/WshLogger/) for the options `--logger`.\n\n## Installation as Module\n\n(1) Create a directory of your WSH project.\n\n```console\nD:\\\u003e mkdir MyWshProject\nD:\\\u003e cd MyWshProject\n```\n\n(2) Download this ZIP and unzip or Use the following `git` command.\n\n```console\n\u003e git clone https://github.com/tuckn/WshSmbConnector.git ./WshModules/WshSmbConnector\nor\n\u003e git submodule add https://github.com/tuckn/WshSmbConnector.git ./WshModules/WshSmbConnector\n```\n\n(3) Include _.\\\\WshSmbConnector\\\\dist\\\\bundle.js_ into your .wsf file.\nFor Example, if your file structure is\n\n```console\nD:\\MyWshProject\\\n├─ Run.wsf\n├─ MyScript.js\n└─ WshModules\\\n    └─ WshSmbConnector\\\n        └─ dist\\\n          └─ bundle.js\n```\n\nThe content of the above _Run.wsf_ is\n\n```xml\n\u003cpackage\u003e\n  \u003cjob id = \"run\"\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshSmbConnector/dist/bundle.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./MyScript.js\"\u003e\u003c/script\u003e\n  \u003c/job\u003e\n\u003c/package\u003e\n```\n\nI recommend this WSH file (.wsf) encoding to be UTF-8 [BOM, CRLF].\n\n### Together with another Apps\n\nIf you want to use it together with another Apps, install as following\n\n```console\n\u003e git clone https://github.com/tuckn/WshBasicPackage.git ./WshModules/WshBasicPackage\n\u003e git clone https://github.com/tuckn/WshSmbConnector.git ./WshModules/WshSmbConnector\n\u003e git clone https://github.com/tuckn/WshDirBackUpper.git ./WshModules/WshDirBackUpper\nor\n\u003e git submodule add https://github.com/tuckn/WshBasicPackage.git ./WshModules/WshBasicPackage\n\u003e git submodule add https://github.com/tuckn/WshSmbConnector.git ./WshModules/WshSmbConnector\n\u003e git submodule add https://github.com/tuckn/WshDirBackUpper.git ./WshModules/WshDirBackUpper\n```\n\n```xml\n\u003cpackage\u003e\n  \u003cjob id = \"run\"\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshBasicPackage/dist/bundle.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshSmbConnector/dist/module.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./WshModules/WshDirBackUpper/dist/module.js\"\u003e\u003c/script\u003e\n    \u003cscript language=\"JScript\" src=\"./MyScript.js\"\u003e\u003c/script\u003e\n  \u003c/job\u003e\n\u003c/package\u003e\n```\n\n## Usage as Module\n\nNow _.\\\\MyScript.js_ (JScript ) can use `Wsh.SmbConnector`.\n\nConnecting and logging\n\n```js\nvar smbcn = Wsh.SmbConnector; // Shorthand\n\nvar comp = '11.22.33.44';\nvar share = 'public';\nvar domain = 'PCNAME';\nvar user = 'UserId';\nvar pwd = 'My * P@ss\u003e\u003c';\n\nsmbcn.connectSyncSurelyUsingLog(comp, share, domain, user, pwd, {\n  logger: 'warn/winEvent', // See https://github.com/tuckn/WshLogger\n  showsResult: true\n});\n```\n\nSchema Connecting\n\n```js\nvar smbcn = Wsh.SmbConnector; // Shorthand\n\nvar schema = {\n  smbConnectorSchema: {\n    components: {\n      myUser: 'user1',\n      myPass: null\n    },\n    tasks: {\n      home: {\n        comp: '11.22.33.44',\n        share: 'Public',\n        user: '${myUser}',\n        pwd: '${myPass}'\n      },\n      office: {\n        comp: 'SV12345',\n        share: 'IPC$',\n        domain: 'ID123456',\n        user: '${myUser}',\n        pwd: '${myPass}'\n      }\n    }\n  }\n};\n\nsmbcn.connectSyncUsingSchema(schema, '*', {\n  logger: 'info/console',\n  overwrites: { myPass: 'user p@ss' },\n  isDryRun: true\n});\n```\n\n### Dependency Modules\n\nYou can also use [tuckn/WshBasicPackage](https://github.com/tuckn/WshBasicPackage) functions in _.\\\\MyScript.js_ (JScript).\n\n## Documentation\n\nSee all specifications [here](https://tuckn.net/docs/WshSmbConnector/) and also [WshBasicPackage](https://tuckn.net/docs/WshBasicPackage/).\n\n## License\n\nMIT\n\nCopyright (c) 2020 [Tuckn](https://github.com/tuckn)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuckn%2Fwshsmbconnector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuckn%2Fwshsmbconnector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuckn%2Fwshsmbconnector/lists"}