Is it possible to create a string in a C# .exe and use this string in PowerShell?
Yes. You can use .NET classes in powershell, for instance you can use:
PS C:\> [System.Environment]::GetLogicalDrives()
when dealing with a static method.
Yes.
Your question is quite vague - are you using a powershell script to create an object from the c# assembly, then using that object? If so, simply set a property to the string you want and access it as normal from powershell.
Or, if it's a static method, you can just call it
[My.Assembly.Type]::GetSomeString()
If you are running the c# exe, you can simply output it with writeline and powershell will pick it up:
.\myexe.exe > $someVar
Or, you can write it as a cmdlet, and your c# code can participate in the pipeline.
Powershell uses the .net Framework under the covers, all objects are CLR object
In the event you are hosting PowerShell within a C# app and you want to access a string variable defined in C# from the PowerShell script that you run, here's how to do that:
string foo = "some string defined in C# to be used in PowerShell";
runspace.SessionStateProxy.SetVariable("foo", foo);
You can then reference this variable in your PowerShell script as $foo
.