I have quite a few libraries that share the same column names and all need to be given default values.
Rather than doing this by hand in the GUI I am turning to PS.
I have few lines of PS (see below) and this works fine but I don't want to have to keep typing pasting so have decided I need to turn it into a script and pass three arguments to it so I can keep calling the script with different values.
Can someone advise the correct syntax to transform these lines into UpdateColumns.ps1 and then how I would call it and pass threee arguments please.
I have replaced the hard coded values with $VAR1, $VAR2 and $VAR3 to show what I need to use as arguments.
$site = Get-SPWeb http://server/site/sub
$list = $web.Lists[$VAR1]
$Field = $List.Fields[$VAR2]
$Field.DefaultValue = $VAR3
$Field.Update()
$List.Update()
$web.Dispose()