Best Practices

The following are best practices from this chapter:

• If a function needs to persist across PowerShell sessions, define that function within your profile.ps1 file.

• To access block information about a base, use the BaseObject property with the PSBase standard name.

• When naming a variable, don’t use special characters or spaces.

• When using aliases and variables in a script, use names that other people can understand.

• If possible, try not to use aliases in a script.

• In a production environment, don’t configure the PowerShell execution policy as unrestricted and always digitally sign your scripts.

• If built-in PowerShell cmdlets don’t meet your needs, always remember that you can fall back onto existing automation interfaces ...

Get Windows Server® 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.