-
Notifications
You must be signed in to change notification settings - Fork 1
/
boot.ps1
81 lines (67 loc) · 2.01 KB
/
boot.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# BOOT
function available-functions{
Write-Host "help {available-functions}"
Write-Host "know {know-Host}"
Write-Host "policy {policy}"
Write-Host "users {users}"
Write-Host "time {current-time}"
Write-Host "services {view-services} "
Write-Host "hkcu {current_user-registro}"
Write-Host "cd {move_to_directory}"
Write-Host "discs {view_available_discs}"
Write-Host "search {search_resource}"
Write-Host "ls {ls}"
Write-Host "ip {ipconfig}"
}
function know-Host {
Get-WmiObject -Class Win32_ComputerSystem
}
function policy {
Get-ExecutionPolicy
Get-ExecutionPolicy -List | Format-Table -AutoSize
}
function users {
Get-WmiObject -Class Win32_OperatingSystem -ComputerName . | Select-Object -Property NumberOfLicensedUsers,NumberOfUsers,RegisteredUser
}
function current-time {
Get-WmiObject -Class Win32_LocalTime -ComputerName . | Select-Object -Property [a-z]* #
}
function view-services {
Get-WmiObject -Class Win32_Service -ComputerName . | Format-Table -Property Status,Name,DisplayName -AutoSize -Wrap
}
function current_user-registro {
Set-Location hkcu:
ls
}
function move_to_directory{
$path = Read-Host -Prompt 'Insert directory to move (remember : for work)'
Set-Location $path
ls
}
function view_available_discs{
Get-PSDrive
}
function search_resource {
$path = Read-Host -Prompt 'Insert resource to search (separate with ,)'
Get-ChildItem –Recurse -name | Select-String Policy, Standard
}
while($true){
$command = Read-Host -Prompt "Insert command";
Write-Host -"Executing >" $command
switch ($command)
{
help {available-functions}
know {know-Host}
policy {policy}
users {users}
time {current-time}
services {view-services}
hkcu {current_user-registro}
cd {move_to_directory}
discs {view_available_discs}
search {search_resource}
ls {ls}
ip {ipconfig}
default {"The command is not recogniced"}
}
}