Jump to content
Forcys

.ini files not generated correctly by Pulseway

Recommended Posts

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 by Forcys

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...