Category Archives: PowerShell V3

PowerShell package management on PowerShell 3 and 4

PowerShell 5.0 introduced PackageManagement (Oneget) – for managing software installation packages and PowerShellGet for managing PowerShell modules. Those features are now available on PowerShell 3 and 4 https://blogs.msdn.microsoft.com/powershell/2016/03/08/package-management-preview-march-2016-for-powershell-4-3-is-now-available/

Posted in PowerShell V3, PowerShell v4, PowerShell v5 | Leave a comment

Creating NIC team without knowing the team members

I was asked how to create a NIC team only using the 1GB adapters without knowing how many 1gb NICs were on the server.   I think this should solve the problem   New-NetLbfoTeam -TeamMembers (Get-NetAdapter | where Speed -ge … Continue reading

Posted in Networking, PowerShell V3, PowerShell v4 | 1 Comment

CIM or WMI – – accessing remote machines

I much prefer the CIM cmdlets for accessing remote machines. The WMI cmdlets use DCOM which is firewall unfriendly and can often be unavailable of a server – cue the dreaded RPC server is unavailable error messages. By contrast the … Continue reading

Posted in CIM, PowerShell and WMI, PowerShell V3, PowerShell v4 | Leave a comment

Finding a CIM class

I was investigating something on my disks and started to look at the partitions: £> Get-CimInstance -ClassName Win32_PartitionGet-CimInstance : Invalid classAt line:1 char:1+ Get-CimInstance -ClassName Win32_Partition+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : MetadataError: (root\cimv2:Win32_Partition:String) [Get-CimInstance], CimException    + FullyQualifiedErrorId : HRESULT 0x80041010,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand OK … Continue reading

Posted in PowerShell and WMI, PowerShell V3 | Leave a comment

CIM or WMI – – using methods

The CIM and WMI cmdlets both provide a way to use the methods on CIM classes namely Invoke-CimMethod and Invoke-WmiMethod. The cmdlets are very similar in operation. $vol = Get-WmiObject -Class Win32_Volume -Filter “DriveLetter = ‘D:’” Invoke-WmiMethod -InputObject $vol -Name … Continue reading

Posted in PowerShell and WMI, PowerShell V3, PowerShell v4 | Leave a comment

Workflows 7: checkpointing workflows

Consider this workflow workflow chkpt1 { Get-Process foreach ($x in 1..20){$x} }   It will dump out the process information then output the numbers 1 to 20.  Not a particularly enlightening workflow but it forms  a nice basis for demonstrating … Continue reading

Posted in PowerShell V3, PowerShell v4 | Leave a comment

Workflows 6: suspending jobs

One of the great things about work flows is that you can stop and start them. A workflow can be stopped, on a temporary basis, by using the Suspend-Workflow activity. workflow suspend1 {Get-Service Suspend-Workflow Get-Process }suspend1   This will run … Continue reading

Posted in PowerShell V3, PowerShell v4 | Leave a comment