Skip to content

Latest commit

 

History

History
27 lines (25 loc) · 1.41 KB

Functions.md

File metadata and controls

27 lines (25 loc) · 1.41 KB

Misc. Functions

Function to Determine PC/Server/Domain Controller Configuration of PC

Function Get-PCType(){
 If ((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq 1){
  Write-Host "This is a Workstation"
  }ElseIf((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq 2){
   Write-Host "This is a Domain Controller"
  }ElseIf((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType -eq 3){
   Write-Host "This is a Server (But NOT a DC)"
  }Else{Write-Host "Unknown PC Type"}
 }

Function to Determine Zone Identifier of Downloaded File

Function Get-ZoneIdent($1){
 If ((Get-Item $1 -Stream Zone.Identifier) -eq 0){
  Write-Host "$1 Came from Zone 'My Computer'"
 }ElseIf((Get-Item $1 -Stream Zone.Identifier) -eq 1){
  Write-Host "$1 came from Zone 'Local Intranet Zone'"
 }ElseIf((Get-Item $1 -Stream Zone.Identifier) -eq 2){
  Write-Host "$1 came from Zone 'Trusted Sites Zone'"
 }ElseIf((Get-Item $1 -Stream Zone.Identifier) -eq 3){
  Write-Host "$1 came from Zone 'Internet Zone'"
 }ElseIf((Get-Item $1 -Stream Zone.Identifier) -eq 4){
  Write-Host "$1 came from Zone 'Restricted Sites Zone'"
 }Else{Write-Host "Unknown Zone Info"}
 }