Download PowerShell-master/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1 from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1
-
curl -L -o CimSession.Tests.ps1 https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1
1.54 kB
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT License. | |
| Describe "New-CimSession" -Tag @("CI","RequireAdminOnWindows") { | |
| BeforeAll { | |
| $sessions = @() | |
| } | |
| AfterEach { | |
| $sessions | Remove-CimSession -ErrorAction SilentlyContinue | |
| $sessions = @() | |
| } | |
| It "A cim session can be created" -Pending:(-not $IsWindows) { | |
| $sessionName = [guid]::NewGuid().Guid | |
| $session = New-CimSession -ComputerName . -Name $sessionName | |
| $sessions += $session | |
| $session.Name | Should -BeExactly $sessionName | |
| $session.InstanceId | Should -BeOfType System.Guid | |
| } | |
| It "A Cim session can be retrieved" -Pending:(-not $IsWindows) { | |
| $sessionName = [guid]::NewGuid().Guid | |
| $session = New-CimSession -ComputerName . -Name $sessionName | |
| $sessions += $session | |
| (Get-CimSession -Name $sessionName).InstanceId | Should -Be $session.InstanceId | |
| (Get-CimSession -Id $session.Id).InstanceId | Should -Be $session.InstanceId | |
| (Get-CimSession -InstanceId $session.InstanceId).InstanceId | Should -Be $session.InstanceId | |
| } | |
| It "A cim session can be removed" -Pending:(-not $IsWindows) { | |
| $sessionName = [guid]::NewGuid().Guid | |
| $session = New-CimSession -ComputerName . -Name $sessionName | |
| $sessions += $session | |
| $session.Name | Should -BeExactly $sessionName | |
| $session | Remove-CimSession | |
| Get-CimSession $session.Id -ErrorAction SilentlyContinue | Should -BeNullOrEmpty | |
| } | |
| } | |