Copy & paste DSC code changes 'Type' to Get-Content'

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
tzvika
Posts: 2
Last visit: Thu Sep 09, 2021 4:09 am

Copy & paste DSC code changes 'Type' to Get-Content'

Post by tzvika »

Product, version and build: PowerShell Studio 2017 v5.4.145
32 or 64 bit version of product: 64
Operating system: 64

When copying this text from a text editor:

Configuration MyTestConfig
{
Node ('localhost')
{
File FolderTest1
{
Ensure = "Present"
DestinationPath = "D:\DscTest1"
Type = "Directory"
}
}
}

Powershell studio automatically changes the text 'Type' to 'Get-Content' even though it's within a DSC context.
(btw,I reported this issue on a different post last August, see viewtopic.php?f=12&t=11772&p=63539#p63539 )
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Copy & paste DSC code changes 'Type' to Get-Content'

Post by davidc »

What platform do you have selected? Because when V2 is selected, it doesn't understand configurations and it will treat it as commands.
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Copy & paste DSC code changes 'Type' to Get-Content'

Post by davidc »

DSC / Configurations require PowerShell V4 or greater.
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Copy & paste DSC code changes 'Type' to Get-Content'

Post by davidc »

You can create a remote profile of another machine if you need to:

https://www.sapien.com/blog/2012/10/15/ ... es-part-1/
https://www.sapien.com/blog/2012/10/16/ ... es-part-2/

Or use the Cache Editor to create a new profile that uses V4 or V5. This way you get PrimalSense for V4 even if you have a different version installed locally.

https://www.sapien.com/blog/2018/01/02/ ... he-editor/
David
SAPIEN Technologies, Inc.
This topic is 6 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.