You must change the value of the --path.data switch in the filebeat configuration.
-path.data "C:\ProgramData\filebeat"
New-Service -name filebeat
-displayName Filebeat
-binaryPathName ""$workdir\filebeat.exe" -c "$workdir\filebeat.yml" -path.home "$workdir" -path.data "C:\ProgramData\filebeat" -path.logs "C:\ProgramData\filebeat\logs" -E logging.files.redirect_stderr=true"