You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This command is designed to solve the problem when you want to run a function loaded locally on a remote computer. Copy-PSFunction will copy a PowerShell function that is loaded in your current PowerShell session to a remote PowerShell session. The remote session must already be created. The copied function only exists remotely for the duration of the remote PowerShell session.
56
+
57
+
```powershell
58
+
$s = new-pssession -ComputerName win10 -cred $art
59
+
Copy-PSFunction Get-Status -Session $s
60
+
```
61
+
62
+
Once copied, you might use `Invoke-Command` to run it.
If the function relies on external or additional files, you will have to copy them to the remote session separately.
69
+
53
70
### [Get-PSProfile](docs/Get-PSProfile.md)
54
71
55
72
This command is designed for Windows systems and make it easy to identify all possible PowerShell profile scripts. Including those for hosts such as VSCode or the PowerShell ISE. The command writes a custom object to the pipeline which has defined formatting. The default view is a table.
This function will return all variables not defined by PowerShell or by this function itself. The default is to return all user-created variables from the global scope but you can also specify a scope such as script, local or a number 0 through 5.
374
+
This function will return all variables not defined by PowerShell or by this function itself. The default is to return all user-created variables from the global scope but you can also specify a scope such as `script`, `local` or a number 0 through 5.
358
375
359
376
```text
360
377
PS C:\> Get-MyVariable
@@ -1048,7 +1065,7 @@ This is a handy command when traveling and your laptop is using a locally derive
1048
1065
It can be tricky sometimes to see a time in a foreign location and try to figure out what that time is locally. This command attempts to simplify this process. In addition to the remote time, you need the base UTC offset for the remote location.
1049
1066
1050
1067
```text
1051
-
PS C:\> Get-TimeZone -ListAvailable | Where-Object id -match hawaii
1068
+
PS C:\> Get-TimeZone -ListAvailable | Where-Object id -match Hawaii
1052
1069
1053
1070
1054
1071
Id : Hawaiian Standard Time
@@ -1628,7 +1645,7 @@ OperatingSystem : Microsoft Windows 10 Pro
1628
1645
Runtime : 40.21:12:01
1629
1646
```
1630
1647
1631
-
If you run this command within VS Code and specify `-Passthru`, the resulting file will be opened in your editor.
1648
+
If you run this command from Visual Studio Code and specify `-Passthru`, the resulting file will be opened in your editor.
1632
1649
1633
1650
### [Test-IsPSWindows](docs/Test-IsPSWindows.md)
1634
1651
@@ -1815,4 +1832,4 @@ If you find this module useful, you might also want to look at my PowerShell too
1815
1832
1816
1833
Where possible these commands have been tested with PowerShell 7, but not every platform. If you encounter problems, have suggestions or other feedback, please post an [issue](https://github.com/jdhitsolutions/PSScriptTools/issues). It is assumed you will __not__ be running these commands on any edition of PowerShell Core or any beta releases of PowerShell 7.
This command is designed to solve the problem when you want to run a function loaded locally on a remote computer. Copy-PSFunction will copy a PowerShell function that is loaded in your current PowerShell session to a remote PowerShell session. The remote session must already be created. The copied function only exists remotely for the duration of the remote PowerShell session.
23
+
24
+
If the function relies on external or additional files, you will have to copy them to the remote session separately.
Copy the local functions Get-LastBoot and Get-DiskFree to a previously created PSSession saved as $S. You could then run the function remotely using Invoke-Command.
35
+
36
+
## PARAMETERS
37
+
38
+
### -Force
39
+
40
+
Overwrite an existing function with the same name. The default behavior is to skip existing functions.
41
+
42
+
```yaml
43
+
Type: SwitchParameter
44
+
Parameter Sets: (All)
45
+
Aliases:
46
+
47
+
Required: False
48
+
Position: Named
49
+
Default value: None
50
+
Accept pipeline input: False
51
+
Accept wildcard characters: False
52
+
```
53
+
54
+
### -Name
55
+
56
+
Enter the name of a local function.
57
+
58
+
```yaml
59
+
Type: String[]
60
+
Parameter Sets: (All)
61
+
Aliases:
62
+
63
+
Required: True
64
+
Position: 1
65
+
Default value: None
66
+
Accept pipeline input: True (ByValue)
67
+
Accept wildcard characters: False
68
+
```
69
+
70
+
### -Session
71
+
72
+
Specify an existing PSSession.
73
+
74
+
```yaml
75
+
Type: PSSession
76
+
Parameter Sets: (All)
77
+
Aliases:
78
+
79
+
Required: True
80
+
Position: Named
81
+
Default value: None
82
+
Accept pipeline input: False
83
+
Accept wildcard characters: False
84
+
```
85
+
86
+
### CommonParameters
87
+
88
+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
This is a PowerShell version of the winver.exe utility. This command uses PowerShell remoting to query the registry on a remote machine to retrieve Windows version information. The parameters are the same as in Invoke-Command.
24
24
25
+
If you are querying the local computer, all other parameters will be ignored.
26
+
25
27
## EXAMPLES
26
28
27
29
### EXAMPLE 1
@@ -68,7 +70,7 @@ Windows Server 2016 Standard ServerStandardEval 1607 14393 2/6/2020 5
68
70
Evaluation
69
71
```
70
72
71
-
Get windows version information from remote computers using an alternate credential.
73
+
Get Windows version information from remote computers using an alternate credential.
72
74
73
75
### Example 3
74
76
@@ -183,7 +185,7 @@ The default value is Default.
183
185
184
186
CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of the Windows operating system.
185
187
186
-
For information about the values of this parameter, see the description of the AuthenticationMechanismEnumeration (http://go.microsoft.com/fwlink/?LinkID=144382) in theMicrosoft Developer Network (MSDN) library.
188
+
For information about the values of this parameter, see the description of the AuthenticationMechanismEnumeration (http://go.microsoft.com/fwlink/?LinkID=144382) in the Microsoft Developer Network (MSDN) library.
187
189
188
190
CAUTION: Credential Security Support Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share.
189
191
This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.
This is a PowerShell version of the winver.exe utility.T his command uses PowerShell remoting to query the registry on a remote machine to retrieve Windows version information. The parameters are the same as in Invoke-Command. The command writes a string of version information.
25
25
26
+
If you are querying the local computer, all other parameters will be ignored.
27
+
26
28
## EXAMPLES
27
29
28
30
### EXAMPLE 1
@@ -141,7 +143,7 @@ The default value is Default.
141
143
142
144
CredSSP authentication is available only in Windows Vista, Windows Server 2008, and later versions of the Windows operating system.
143
145
144
-
For information about the values of this parameter, see the description of the AuthenticationMechanismEnumeration (http://go.microsoft.com/fwlink/?LinkID=144382) in theMicrosoft Developer Network (MSDN) library.
146
+
For information about the values of this parameter, see the description of the AuthenticationMechanismEnumeration (http://go.microsoft.com/fwlink/?LinkID=144382) in the Microsoft Developer Network (MSDN) library.
145
147
146
148
CAUTION: Credential Security Support Provider (CredSSP) authentication, in which the user's credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share.
147
149
This mechanism increases the security risk of the remote operation. If the remote computer is compromised, the credentials that are passed to it can be used to control the network session.
0 commit comments