Forcys Posted November 15, 2019 Share Posted November 15, 2019 (edited) Pulseway doesn't seem to send the following script to create an INI file correctly to the target computer. The script runs fine on local Powershell, but it creates a setupconfig.ini file with text as a long string when run through Pulseway. $fqdn=(Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain $fqdn=$fqdn.Substring($fqdn.IndexOf(".") + 1) $sysfolder="\\$env:computername\sysvol\$fqdn\policies\" $setupconfig="\\$env:computername\sysvol\$fqdn\policies\setupconfig.ini" $functiontext = @" [Setupconfig] auto=upgrade BitLocker=AlwaysSuspend Compat=IgnoreWarning Priority=Normal DynamicUpdate=Enable ShowOOBE=None Telemetry=Enable DiagnosticPrompt=Enable "@ new-item $setupconfig -type file -force -value $functiontext Anything I need to change? Edited November 20, 2019 by Forcys Link to comment Share on other sites More sharing options...
Administrators Paul Posted November 15, 2019 Administrators Share Posted November 15, 2019 Most likely it's a line ending problem. Try adding this line before new-item: $functiontext = $functiontext -replace "`r", "" #avoid duplicating the carriage return $functiontext = $functiontext -replace "`n", "`r`n" -Paul Link to comment Share on other sites More sharing options...
Forcys Posted November 20, 2019 Author Share Posted November 20, 2019 Thank you very much, this did the trick indeed! Paul 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now