I am trying to write a script that writes PowerShell profiles. This is helpful for new users who want a profile that will automate what they are doing daily.
I am trying to figure out how I can take a large chunk of script with various objects and write it to a profile that was just made a few lines before.
The problem I am running into is that I am trying to turn a large block of script into a string that can then be written to that profile.
An example:
$text='"welcome, want to go to site?"
$goyn=read-host -prompt "enter y or n"
if($goyn -eq 'y'){
start 'www.google.ca'
}
else{"continue on your journey of awesomeness"}
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Get-WmiObject -Class Win32_OperatingSystem -ComputerName localhost |
Select-Object -Property CSName,@{n="Last Booted";
e={[Management.ManagementDateTimeConverter]::ToDateTime($_.LastBootUpTime)}}'
I have tried putting it between single quotes then passing it into a variable but to no avail.
Set-ContentandAdd-Contentcmdlets?