Changes

Jump to: navigation, search

Windows PowerShell 1.0 Functions

1,073 bytes added, 20:38, 4 December 2008
Windows PowerShell Function Administration
== Windows PowerShell Function Administration ==
 
Functions declared within PowerShell are stored in the ''function'' namespace which is mapped to a virtual ''function:'' drive. As such, functions can be manipulated and administered much in the same way files in a filesytem are handled. It is possible, for example, to list the ''multiply'' function created earlier in this chapter using the ''dir'' command:
 
<pre>
PS C:\Users\Administrator> dir function:/multiply
 
CommandType Name Definition
----------- ---- ----------
Function multiply param([int32] $val1, [int32] $val2) "P...
</pre>
 
Similarly, the function can be deleted just as a file would be deleted using the ''rm'' command. Since we are at the end of the chapter, we can now safely delete the functions created in the preceding sections:
 
<pre>
PS C:\Users\Administrator> rm function:multiply
PS C:\Users\Administrator> rm function:names
PS C:\Users\Administrator> rm function:hello
PS C:\Users\Administrator> rm function:hello
</pre>

Navigation menu