Skip to content

Instantly share code, notes, and snippets.

@huynhbaoan
Created November 30, 2022 10:25
Show Gist options
  • Save huynhbaoan/d4a6a09c61258fc8e8b76aebfc63d91d to your computer and use it in GitHub Desktop.
Save huynhbaoan/d4a6a09c61258fc8e8b76aebfc63d91d to your computer and use it in GitHub Desktop.
Different from bash, PowerShell is object-orriented. Understanding objects are necessary to utilize PowerShell
Get-NetIPAddress -AddressFamily IPV4 -AddressState Preferred -IncludeAllCompartments | Get-Member
TypeName: Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress
Name MemberType Definition
---- ---------- ----------
ifIndex AliasProperty ifIndex = InterfaceIndex
Clone Method System.Object ICloneable.Clone()
Dispose Method void Dispose(), void IDisposable.Dispose()
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetObjectData Method void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.St...
GetType Method type GetType()
Address Property string Address {get;set;}
AddressOrigin Property uint16 AddressOrigin {get;set;}
AddressType Property uint16 AddressType {get;set;}
ToString ScriptMethod System.Object ToString();
AddressState ScriptProperty System.Object AddressState {get=[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Address...
PrefixOrigin ScriptProperty System.Object PrefixOrigin {get=[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixO...
Store ScriptProperty System.Object Store {get=[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Store]($this.P...
SuffixOrigin ScriptProperty System.Object SuffixOrigin {get=[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixO...
Type ScriptProperty System.Object Type {get=[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type]($this.PSB...
@huynhbaoan
Copy link
Author

huynhbaoan commented Dec 19, 2022

Run PowerShell script, bypass restriction policy

powershell -ExecutionPolicy Bypass -File

Run PowerShell script, waiting command promt

Read-Host -Prompt "Press Enter to exit"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment