-
Notifications
You must be signed in to change notification settings - Fork 1
/
Testing.ps1
60 lines (36 loc) · 1.32 KB
/
Testing.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
Testing.ps1
#this is a test script
$PSversionTable
Start-Transcript -Path 'C:\Users\zakna\OneDrive\Documents\PowerShell Scripts\TranscriptTesting'
Get-WinEvent -LogName "Security" -MaxEvents 5
Get-NetConnectionProfile -name "TelstraCB4063" -Verbose
#region RemoteInstall
#test code
Find-Package -name winget #try this when it's out of alpha, it's currently version 0.0.1 as of 23/5/2020
install-package -name winget
#endregion RemoteInstall
#region hashtable
$p = @{"PowerShell" = (Get-Process PowerShell);
"Notepad" = (Get-Process notepad);
"edge" = (get-process msedge);}
$p.Count
#endregion hashtable
#region virtual_machine
$winRMSrv = get-service -name WinRM
if ($winRMSrv.Status -eq "stopped")
{
start-service -name winrm
$session = New-CimSession -ComputerName localhost
New-NetworkSwitchVlan -CimSession $session
}
#endregion virtual_machine
Stop-Transcript
#region runspace
$ps = [powershell]::Create()
$rpcComputerInfo = [System.Management.Automation.]
$ps.AddScript("Get-Process -id $pid")
$rs = [runspacefactory]::CreateRunspace($host, $rpcComputerInfo)
#endregion runspace
get-ciminstance -ClassName CIM_ComputerSystem | format-list
Get-CimInstance -ClassName CIM_Chip | Out-Host -Paging
get-ciminstance -ClassName Win32_BIOS