Elasticsearch not generating password when started for the first time

Hi,

I have installed a fresh instance of Elasticsearch 8.1.0.
Configurations I added:

cluster.name: elasticsearch-8_1_0_windows_local_2
network.host: localhost
http.port: 29200

I open cmd on windows machine as an administrator. and run Elasticsearch.bat file. Earlier it used to generate password for the elastic user, which I would use to login. Also it used to generate certificates and add below configuration in kibana automatically.

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 11-03-2022 06:20:25
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: true

xpack.security.enrollment.enabled: true

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["LIN20002873"]

# Allow HTTP API connections from localhost and local networks
# Connections are encrypted and require user authentication
http.host: [_local_, _site_]

# Allow other nodes to join the cluster from localhost and local networks
# Connections are encrypted and mutually authenticated
#transport.host: [_local_, _site_]

#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

But neither of these are happening now, and I am getting this error:

ERROR: Aborting auto configuration because of config dir ownership mismatch. Config dir is owned by CORP\avisriva but auto-configuration directory would be owned by BUILTIN\Administrators

I am also adding the entire log for reference:

C:\Office_Work\elasticsearch-8.1.0-windows-x86_64\elasticsearch-8.1.0\bin>elasticsearch.bat
warning: ignoring JAVA_HOME=C:\Program Files\Java\jdk-11.0.12; using bundled JDK
warning: ignoring JAVA_HOME=C:\Program Files\Java\jdk-11.0.12; using ES_JAVA_HOME

ERROR: Aborting auto configuration because of config dir ownership mismatch. Config dir is owned by CORP\avisriva but auto-configuration directory would be owned by BUILTIN\Administrators
[2022-06-05T20:39:41,025][INFO ][o.e.n.Node               ] [LIN20002873] version[8.1.0], pid[19948], build[default/zip/3700f7679f7d95e36da0b43762189bab189bc53a/2022-03-03T14:20:00.690422633Z], OS[Windows 10/10.0/amd64], JVM[Eclipse Adoptium/OpenJDK 64-Bit Server VM/17.0.2/17.0.2+8]
[2022-06-05T20:39:41,025][INFO ][o.e.n.Node               ] [LIN20002873] JVM home [C:\Office_Work\elasticsearch-8.1.0-windows-x86_64\elasticsearch-8.1.0\jdk], using bundled JDK [true]
[2022-06-05T20:39:41,025][INFO ][o.e.n.Node               ] [LIN20002873] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=C:\Users\avisriva\AppData\Local\Temp\elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Xms3999m, -Xmx3999m, -XX:MaxDirectMemorySize=2097152000, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Delasticsearch, -Des.path.home=C:\Office_Work\elasticsearch-8.1.0-windows-x86_64\elasticsearch-8.1.0, -Des.path.conf=C:\Office_Work\elasticsearch-8.1.0-windows-x86_64\elasticsearch-8.1.0\config, -Des.distribution.flavor=default, -Des.distribution.type=zip, -Des.bundled_jdk=true]
[2022-06-05T20:39:46,723][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [aggs-matrix-stats]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [analysis-common]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [constant-keyword]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [data-streams]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [frozen-indices]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [ingest-common]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [ingest-geoip]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [ingest-user-agent]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [kibana]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [lang-expression]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [lang-mustache]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [lang-painless]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [legacy-geo]
[2022-06-05T20:39:46,754][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [mapper-extras]
[2022-06-05T20:39:46,770][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [mapper-version]
[2022-06-05T20:39:46,770][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [old-lucene-versions]
[2022-06-05T20:39:46,770][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [parent-join]
[2022-06-05T20:39:46,786][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [percolator]
[2022-06-05T20:39:46,786][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [rank-eval]
[2022-06-05T20:39:46,786][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [reindex]
[2022-06-05T20:39:46,786][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [repositories-metering-api]
[2022-06-05T20:39:46,786][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [repository-azure]
[2022-06-05T20:39:46,786][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [repository-encrypted]
[2022-06-05T20:39:46,801][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [repository-gcs]
[2022-06-05T20:39:46,801][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [repository-s3]
[2022-06-05T20:39:46,808][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [repository-url]
[2022-06-05T20:39:46,808][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [runtime-fields-common]
[2022-06-05T20:39:46,808][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [search-business-rules]
[2022-06-05T20:39:46,808][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [searchable-snapshots]
[2022-06-05T20:39:46,808][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [snapshot-based-recoveries]
[2022-06-05T20:39:46,808][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [snapshot-repo-test-kit]
[2022-06-05T20:39:46,808][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [spatial]
[2022-06-05T20:39:46,823][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [transform]
[2022-06-05T20:39:46,823][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [transport-netty4]
[2022-06-05T20:39:46,823][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [unsigned-long]
[2022-06-05T20:39:46,839][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [vector-tile]
[2022-06-05T20:39:46,839][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [vectors]
[2022-06-05T20:39:46,855][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [wildcard]
[2022-06-05T20:39:46,855][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-aggregate-metric]
[2022-06-05T20:39:46,855][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-analytics]
[2022-06-05T20:39:46,870][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-async]
[2022-06-05T20:39:46,870][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-async-search]
[2022-06-05T20:39:46,870][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-autoscaling]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-ccr]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-core]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-deprecation]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-enrich]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-eql]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-fleet]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-graph]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-identity-provider]
[2022-06-05T20:39:46,887][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-ilm]
[2022-06-05T20:39:46,902][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-logstash]
[2022-06-05T20:39:46,908][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-ml]
[2022-06-05T20:39:46,908][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-monitoring]
[2022-06-05T20:39:46,908][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-ql]
[2022-06-05T20:39:46,908][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-rollup]
[2022-06-05T20:39:46,908][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-security]
[2022-06-05T20:39:46,908][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-shutdown]
[2022-06-05T20:39:46,923][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-sql]
[2022-06-05T20:39:46,923][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-stack]
[2022-06-05T20:39:46,939][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-text-structure]
[2022-06-05T20:39:46,939][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-voting-only-node]
[2022-06-05T20:39:46,939][INFO ][o.e.p.PluginsService     ] [LIN20002873] loaded module [x-pack-watcher]
[2022-06-05T20:39:46,955][INFO ][o.e.p.PluginsService     ] [LIN20002873] no plugins loaded
[2022-06-05T20:39:47,545][INFO ][o.e.e.NodeEnvironment    ] [LIN20002873] using [1] data paths, mounts [[System (C:)]], net usable_space [26.4gb], net total_space [237.2gb], types [NTFS]
[2022-06-05T20:39:47,545][INFO ][o.e.e.NodeEnvironment    ] [LIN20002873] heap size [3.9gb], compressed ordinary object pointers [true]
[2022-06-05T20:39:47,730][INFO ][o.e.n.Node               ] [LIN20002873] node name [LIN20002873], node ID [6swjMn7VQWa98migVLrGwA], cluster name [elasticsearch-8_1_0_windows_local_2], roles [data_cold, data, remote_cluster_client, master, data_warm, data_content, transform, data_hot, ml, data_frozen, ingest]
[2022-06-05T20:39:56,008][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [LIN20002873] [controller/14944] [Main.cc@123] controller (64 bit): Version 8.1.0 (Build 36e2300340f08a) Copyright (c) 2022 Elasticsearch BV
[2022-06-05T20:39:56,562][INFO ][o.e.x.s.Security         ] [LIN20002873] Security is enabled
[2022-06-05T20:39:57,112][INFO ][o.e.x.s.a.Realms         ] [LIN20002873] license mode is [trial], currently licensed security realms are [reserved/reserved,file/default_file,native/default_native]
[2022-06-05T20:39:57,139][INFO ][o.e.x.s.a.s.FileRolesStore] [LIN20002873] parsed [0] roles from file [C:\Office_Work\elasticsearch-8.1.0-windows-x86_64\elasticsearch-8.1.0\config\roles.yml]
[2022-06-05T20:39:59,138][INFO ][o.e.t.n.NettyAllocator   ] [LIN20002873] creating NettyAllocator with the following configs: [name=elasticsearch_configured, chunk_size=1mb, suggested_max_allocation_size=1mb, factors={es.unsafe.use_netty_default_chunk_and_page_size=false, g1gc_enabled=true, g1gc_region_size=4mb}]
[2022-06-05T20:39:59,170][INFO ][o.e.i.r.RecoverySettings ] [LIN20002873] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
[2022-06-05T20:39:59,234][INFO ][o.e.d.DiscoveryModule    ] [LIN20002873] using discovery type [multi-node] and seed hosts providers [settings]
[2022-06-05T20:40:00,674][INFO ][o.e.n.Node               ] [LIN20002873] initialized
[2022-06-05T20:40:00,674][INFO ][o.e.n.Node               ] [LIN20002873] starting ...
[2022-06-05T20:40:00,758][INFO ][o.e.x.s.c.f.PersistentCache] [LIN20002873] persistent cache index loaded
[2022-06-05T20:40:00,758][INFO ][o.e.x.d.l.DeprecationIndexingComponent] [LIN20002873] deprecation component started
[2022-06-05T20:40:00,991][INFO ][o.e.t.TransportService   ] [LIN20002873] publish_address {localhost/127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2022-06-05T20:40:01,567][WARN ][o.e.b.BootstrapChecks    ] [LIN20002873] the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2022-06-05T20:40:01,618][WARN ][o.e.b.BootstrapChecks    ] [LIN20002873] Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]
[2022-06-05T20:40:01,628][INFO ][o.e.c.c.ClusterBootstrapService] [LIN20002873] no discovery configuration found, will perform best-effort cluster bootstrapping after [3s] unless existing master is discovered
[2022-06-05T20:40:04,646][INFO ][o.e.c.c.Coordinator      ] [LIN20002873] setting initial configuration to VotingConfiguration{6swjMn7VQWa98migVLrGwA}
[2022-06-05T20:40:05,156][INFO ][o.e.c.s.MasterService    ] [LIN20002873] elected-as-master ([1] nodes joined)[{LIN20002873}{6swjMn7VQWa98migVLrGwA}{Up4hT-haStiWm5OMhw_S5w}{localhost}{127.0.0.1:9300}{cdfhilmrstw} completing election, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{LIN20002873}{6swjMn7VQWa98migVLrGwA}{Up4hT-haStiWm5OMhw_S5w}{localhost}{127.0.0.1:9300}{cdfhilmrstw}]}
[2022-06-05T20:40:05,545][INFO ][o.e.c.c.CoordinationState] [LIN20002873] cluster UUID set to [8YIAnMp-SFGPA7l9397vtA]
[2022-06-05T20:40:05,895][INFO ][o.e.c.s.ClusterApplierService] [LIN20002873] master node changed {previous [], current [{LIN20002873}{6swjMn7VQWa98migVLrGwA}{Up4hT-haStiWm5OMhw_S5w}{localhost}{127.0.0.1:9300}{cdfhilmrstw}]}, term: 1, version: 1, reason: Publication{term=1, version=1}
[2022-06-05T20:40:05,926][INFO ][o.e.c.r.a.DiskThresholdMonitor] [LIN20002873] low disk watermark [85%] exceeded on [6swjMn7VQWa98migVLrGwA][LIN20002873][C:\Office_Work\elasticsearch-8.1.0-windows-x86_64\elasticsearch-8.1.0\data] free: 26.4gb[11.1%], replicas will not be assigned to this node
[2022-06-05T20:40:06,033][INFO ][o.e.h.AbstractHttpServerTransport] [LIN20002873] publish_address {localhost/127.0.0.1:29200}, bound_addresses {127.0.0.1:29200}, {[::1]:29200}
[2022-06-05T20:40:06,034][INFO ][o.e.n.Node               ] [LIN20002873] started
[2022-06-05T20:40:06,204][INFO ][o.e.g.GatewayService     ] [LIN20002873] recovered [0] indices into cluster_state
[2022-06-05T20:40:06,492][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.monitoring-kibana-mb] for index patterns [.monitoring-kibana-8-*]
[2022-06-05T20:40:06,891][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.monitoring-beats-mb] for index patterns [.monitoring-beats-8-*]
[2022-06-05T20:40:07,323][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.monitoring-ent-search-mb] for index patterns [.monitoring-ent-search-8-*]
[2022-06-05T20:40:07,666][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.ml-notifications-000002] for index patterns [.ml-notifications-000002]
[2022-06-05T20:40:08,008][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.ml-state] for index patterns [.ml-state*]
[2022-06-05T20:40:08,359][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.ml-anomalies-] for index patterns [.ml-anomalies-*]
[2022-06-05T20:40:08,745][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.monitoring-es-mb] for index patterns [.monitoring-es-8-*]
[2022-06-05T20:40:09,082][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.ml-stats] for index patterns [.ml-stats-*]
[2022-06-05T20:40:09,423][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.monitoring-logstash-mb] for index patterns [.monitoring-logstash-8-*]
[2022-06-05T20:40:09,756][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [logs-mappings]
[2022-06-05T20:40:10,115][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [logs-settings]
[2022-06-05T20:40:10,451][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [data-streams-mappings]
[2022-06-05T20:40:10,793][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [synthetics-mappings]
[2022-06-05T20:40:11,158][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [synthetics-settings]
[2022-06-05T20:40:11,509][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-7-*]
[2022-06-05T20:40:11,855][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding template [.monitoring-beats] for index patterns [.monitoring-beats-7-*]
[2022-06-05T20:40:12,228][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [metrics-settings]
[2022-06-05T20:40:12,630][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-7-*]
[2022-06-05T20:40:12,980][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding template [.monitoring-es] for index patterns [.monitoring-es-7-*]
[2022-06-05T20:40:13,318][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding template [.monitoring-alerts-7] for index patterns [.monitoring-alerts-7]
[2022-06-05T20:40:13,660][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [metrics-mappings]
[2022-06-05T20:40:14,081][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.watch-history-16] for index patterns [.watcher-history-16*]
[2022-06-05T20:40:14,423][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [ilm-history] for index patterns [ilm-history-5*]
[2022-06-05T20:40:14,763][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [.deprecation-indexing-mappings]
[2022-06-05T20:40:15,095][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.slm-history] for index patterns [.slm-history-5*]
[2022-06-05T20:40:15,418][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding component template [.deprecation-indexing-settings]
[2022-06-05T20:40:15,757][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [logs] for index patterns [logs-*-*]
[2022-06-05T20:40:16,083][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [synthetics] for index patterns [synthetics-*-*]
[2022-06-05T20:40:16,401][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [metrics] for index patterns [metrics-*-*]
[2022-06-05T20:40:16,740][INFO ][o.e.c.m.MetadataIndexTemplateService] [LIN20002873] adding index template [.deprecation-indexing-template] for index patterns [.logs-deprecation.*]
[2022-06-05T20:40:17,083][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [ml-size-based-ilm-policy]
[2022-06-05T20:40:17,420][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [90-days-default]
[2022-06-05T20:40:17,805][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [.monitoring-8-ilm-policy]
[2022-06-05T20:40:18,113][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [7-days-default]
[2022-06-05T20:40:18,439][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [logs]
[2022-06-05T20:40:18,766][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [180-days-default]
[2022-06-05T20:40:19,094][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [synthetics]
[2022-06-05T20:40:19,409][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [30-days-default]
[2022-06-05T20:40:19,753][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [365-days-default]
[2022-06-05T20:40:20,082][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [metrics]
[2022-06-05T20:40:20,427][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [watch-history-ilm-policy-16]
[2022-06-05T20:40:20,769][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [ilm-history-ilm-policy]
[2022-06-05T20:40:21,086][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [slm-history-ilm-policy]
[2022-06-05T20:40:21,402][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [.fleet-actions-results-ilm-policy]
[2022-06-05T20:40:21,776][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [LIN20002873] adding index lifecycle policy [.deprecation-indexing-ilm-policy]
[2022-06-05T20:40:22,954][INFO ][o.e.l.LicenseService     ] [LIN20002873] license [14711ff1-2990-4192-a866-60e31b758d64] mode [basic] - valid
[2022-06-05T20:40:23,002][INFO ][o.e.x.s.a.Realms         ] [LIN20002873] license mode is [basic], currently licensed security realms are [reserved/reserved,file/default_file,native/default_native]
[2022-06-05T20:40:24,848][INFO ][o.e.c.m.MetadataCreateIndexService] [LIN20002873] [.geoip_databases] creating index, cause [auto(bulk api)], templates [], shards [1]/[0]
[2022-06-05T20:40:25,720][INFO ][o.e.c.r.a.AllocationService] [LIN20002873] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.geoip_databases][0]]])." previous.health="YELLOW" reason="shards started [[.geoip_databases][0]]"
[2022-06-05T20:40:28,347][INFO ][o.e.i.g.GeoIpDownloader  ] [LIN20002873] successfully downloaded geoip database [GeoLite2-ASN.mmdb]
[2022-06-05T20:40:28,879][INFO ][o.e.i.g.DatabaseNodeService] [LIN20002873] successfully loaded geoip database file [GeoLite2-ASN.mmdb]
[2022-06-05T20:40:41,113][INFO ][o.e.i.g.GeoIpDownloader  ] [LIN20002873] successfully downloaded geoip database [GeoLite2-City.mmdb]
[2022-06-05T20:40:43,608][INFO ][o.e.i.g.DatabaseNodeService] [LIN20002873] successfully loaded geoip database file [GeoLite2-City.mmdb]
[2022-06-05T20:40:43,646][INFO ][o.e.i.g.GeoIpDownloader  ] [LIN20002873] successfully downloaded geoip database [GeoLite2-Country.mmdb]
[2022-06-05T20:40:43,977][INFO ][o.e.i.g.DatabaseNodeService] [LIN20002873] successfully loaded geoip database file [GeoLite2-Country.mmdb]

I noticed when I start the command prompt as an Administrator. And running Elasticsearch.bat file from there, it gives above error.

But when I started the command prompt without Administrator. The Elasticsearch was able to generate the password.

Exactly , and this is exactly what the error message above said. We, on purpose, do not attempt to autoconfigure elastisearch when it is not run as the same user that owns the installation directory because we can’t know for certain if we would be able to write all the necessary files to disk.

See also : Start the Elastic Stack with security enabled | Elasticsearch Guide [8.2] | Elastic

Thanks for the info!!