Trying to delete a file with Powershell script ran by a service but issues with uac -


I am having problems with a script that will delete the file on a server's C-drive script looks like this $ StrFileName = "C: \ Program Files \ NSClient ++ \ nsclient.log" $ LogLocal = "$ string =" $ string " C: \ Nagios \ naf_delete_nscp_log_file.log "$ date = gate-date-format" yyyy-MM-dd hh: mm: ss "" $ date: $ NSCLINT logfile deletion request is requested on hostname | out-file-filepath $ Loglokal -appen (te St-path "$ strFileName") {Remove-item $ strFileName- Forage $ date = date-get-date-format "yyyy-MM-dd hh: mm: ss" "$ date: $ NSCLIT logfile deleted on hostname" | Out - File-FilePage $ LogLock-Append}

The script is started with Nagyoz Quick Action, which will use NRP to pass the host as a parameter and create the NSCP service , The local system, run it on the server Yes, that UAC is not capable, but I can not work with the UAC on the server. I have tried many options, but no one seems to be doing the job

Thanks

Willem

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -