AllUsersAllHosts : C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
AllUsersCurrentHost : C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts : C:\Users\bob\Documents\WindowsPowerShell\profile.ps1
CurrentUserCurrentHost : C:\Users\bob\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Length : 73
new-item -itemtype directory newfolder
create new folder = mkdir = md
rmdir remove directory
set-executionpolicy remotesigned
run as administrator
PS C:\WINDOWS\system32> get-executionpolicy -list
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser RemoteSigned
LocalMachine RemoteSigned
md C:\Users\bob\Documents\WindowsPowerShell
notepad $profile
create Microsoft.PowerShell_profile.ps1 in C:\Users\bob\Documents\WindowsPowerShell
type get-date in created ps1 file, save, close powershell, reopen
script get-date in profile is executed.
reference:
No comments:
Post a Comment