Browsed by
Category: PowerShell

Installing PowerShell on Linux

Installing PowerShell on Linux

CentOS 7 This package also works on Oracle Linux 7. Installation via Package Repository (preferred) – CentOS 7 PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates). # Register the Microsoft RedHat repository curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo # Install PowerShell sudo yum install -y powershell # Start PowerShell powershell After registering the Microsoft repository once as superuser, you just need to use sudo yum update powershell to update PowerShell. Installation via Direct…

Read More Read More

PowerCLI Useful Scripts And Commands

PowerCLI Useful Scripts And Commands

PowerCLI Useful Scripts And Commands Source: http://www.getshifting.com/wiki/powerclinotes 8/20/2014 PowerCLI Usefull Scripts And Commands This is an overview page with small PowerCLI scripts and or commands. Getting all Possible Values for Objects If only I knew then what I know now! When working on Script: PowerCLI: Create CSV with VMInfo I spent some serious time on finding what properties and values are available on certain objects. Today I finally figured it out, simply use “Select *”: [vSphere PowerCLI] C:\> Get-NetworkAdapter -vm testvm01…

Read More Read More

Accessing SCSM 2012 using PowerShell (without SMLets)

Accessing SCSM 2012 using PowerShell (without SMLets)

Accessing SCSM 2012 using PowerShell (without SMLets) http://ben.neise.co.uk/index.php/2014/01/accessing-scsm-2012-with-powershell/ Accessing SCSM 2012 using PowerShell (without SMLets) 2 Replies I wanted to use PowerShell to create a simple report of open (active & pending) incidents in System Center Service Manager 2012, but the only examples I could find online used the SMLets. Sometimes this wasn’t obvious, but soon became apparent when PowerShell choked over CMDLets likeGet-SCSMObject. While I’m sure the SMLets are handy for ad-hoc reports by administrators, I wanted the option for my report…

Read More Read More

SCSM PowerShell Cmdlets Using SMLets

SCSM PowerShell Cmdlets Using SMLets

SCSM PowerShell Cmdlets Using SMLets SCSM PowerShell Cmdlets Project Description This project provides cmdlets for System Center Service Manager 2010/2010 SP1/2012/2012 SP1/2012 R2 which can be used to automate common tasks. Current commands: Add-SCSMEnumeration Add-SCSMRequestOffering Export-SCManagementPack Get-DataWarehouseConfiguration Get-SCDWDimensionTypes Get-SCDWFactTypes Get-SCDWMeasureTypes Get-SCDWOutriggerTypes Get-SCDWRelationshipFactTypes Get-SCDWWarehouseModuleTypes Get-SCGroup Get-SCManagementPack Get-SCManagementPackElement Get-SCQueue Get-SCSMAnnouncement Get-SCSMCategory Get-SCSMChildEnumeration Get-SCSMClass Get-SCSMConfigItem Get-SCSMConnectedUser Get-SCSMConsoleTask Get-SCSMEnumeration Get-SCSMFolder Get-SCSMFolderHierarchy Get-SCSMForm Get-SCSMImage Get-SCSMIncident Get-SCSMLanguagePackCulture Get-SCSMManagementPackReference Get-SCSMObject Get-SCSMObjectHistory Get-SCSMObjectProjection Get-SCSMObjectTemplate Get-SCSMPage Get-SCSMPageSet Get-SCSMRelatedObject Get-SCSMRelationshipClass Get-SCSMRelationshipObject Get-SCSMRequestOffering Get-SCSMRequestOfferingQuestion Get-SCSMResource Get-SCSMRule Get-SCSMRunAsAccount Get-SCSMServiceOffering Get-SCSMSession Get-SCSMStringResource Get-SCSMSubscription…

Read More Read More

PowerShell Active Directory Commands

PowerShell Active Directory Commands

PowerShell Active Directory Commands Import-Module ActiveDirectory Set-Location AD: Get-ChildItem Set-Location “dc=rickyadams,dc=com” Set-Location “OU=TestOU” Set-ItemProperty -Path ‘.\CN=Ricky Adams’ -Name “Description” -Value “Virtualization Cloud God” Get-ADObject -LDAPFilter “(&(operatingSystem=Windows Server 2008 R2 Standard) (objectClass=computer))” -SearchBase “dc=rickyadams,dc=com” -SearchScope Subtree Search-ADAccount -PasswordExpired -UsersOnly -SearchBase “OU=TestOU,dc=rickyadams,dc=com” -SearchScope OneLevel   List All Servers in AD Get-ADComputer-Filter {OperatingSystem -Like”Windows Server*”} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap-Auto # Only disabled computer accounts Get-QADComputer-ldapFilter‘(userAccountControl:1.2.840.113556.1.4.803:=2)’# Only enabled computer accountsGet-QADComputer-ldapFilter‘(!(userAccountControl:1.2.840.113556.1.4.803:=2))’ #List Active Servers Get-ADComputer-LDAPFilter“((objectcategory=computer)(&(operatingsystem=*Server*))(&(!(userAccountControl:1.2.840.113556.1.4.803:=2))))” -Property *-SearchBase“OU=Servers,DC=rickyadams,DC=com”| Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap-Auto      …

Read More Read More

Powershell to List All Active Windows 2012 Servers from Active Directory

Powershell to List All Active Windows 2012 Servers from Active Directory

Import-ModuleActiveDirectory Set-Location AD: Get-ChildItem #Set-Location “OU=Server Infrastructure,dc=rickyadams,dc=com” Get-ADComputer-LDAPFilter“((objectcategory=computer)(&(operatingsystem=*Server 2012*))(&(!(userAccountControl:1.2.840.113556.1.4.803:=2))))” -Property *-SearchBase“OU=Server Infrastructure,DC=ia,DC=doi,DC=net”| Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap-Auto