• Welcome to Religious Forums, a friendly forum to discuss all religions in a friendly surrounding.

    Your voice is missing! You will need to register to get access to the following site features:
    • Reply to discussions and create your own threads.
    • Our modern chat room. No add-ons or extensions required, just login and start chatting!
    • Access to private conversations with other members.

    We hope to see you as a part of our community soon!

The Random, Meaningless Announcements Thread 3!

Stevicus

Veteran Member
Staff member
Premium Member
Do we have a poster on RF named WW2?

Not sure, but the cat who lives next door to Snoopy is named "World War 2."

1726875288002.png
 

sun rise

The world is on fire
Premium Member
I've been having a grand fight with ChatGPT to create a script to create shares on a destination server which is a replacement for the source server. ChatGPT is great at knowing why the errors it makes exist but is a PITA when it comes to writing good powershell code in the first place. The version it generated from my 4 points generated the last error.

TL;DR non-techy note: Use it but don't trust it unless you can verify correctness when it comes to facts and analysis.

<geek alert>
1. The backtick for multi-line commands got lost it appears `n - the 'n' should not have been there. 2.A list of entries in an access line have to be of the form 'user1','user2' because of spaces. 3. The generated script had multiple entries of the form: BUILTIN\Users,BUILTIN\Users,BUILTIN\Users which is meaningless. 4. Ignore shares on the C: drive

ForEach-Object : Cannot bind parameter 'RemainingScripts'. Cannot convert the "-join" value of type "System.String" to type "System.Management.Automation.ScriptBlock".
At C:\users\me\desktop\generate.shares.9.20.try4.ps1:70 char:71
+ ... lAccess | Select-Object -Unique | ForEach-Object { "'$_'" } -join ","
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: :)) [ForEach-Object], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ForEachObjectCommand

ChatGPT wrote after the last error here:
The error you're encountering is caused by the way the ForEach-Object and -join are combined. The ForEach-Object command is used to process each item in the pipeline, but -join expects an array of strings, not a script block.

To fix this, we can use ForEach-Object to format each user entry and then apply -join separately. Here's the corrected section of the script:
</geek alert>
 
Top