PowerShell Classic Script Storage Room

Source: Internet
Author: User
Tags service flag

Due to the recent more and more like to PowerShell, in the spare time, tidy up some of the common classic examples to share to everyone:

1. Active Directory, listing domain information

#===========================================
# list Domain Information
#===========================================
$strComputer = "." # Zivsoft-lihua

$colItems = Get-wmiobject-class "Win32_ntdomain"-namespace "root\cimv2"
-computername $strComputer

foreach ($objItem in $colItems) {
Write-host "Caption:" $objItem. Caption
Write-host "Client Site Name:" $objItem. Clientsitename
Write-host "Creation Class Name:" $objItem. CreationClassName
Write-host "DC Site Name:" $objItem. Dcsitename
Write-host "Description:" $objItem. Description
Write-host "DNS Forest Name:" $objItem. DnsForestName
Write-host "Domain Controller Address:" $objItem. domaincontrolleraddress
Write-host "Domain Controller address Type:" $objItem. Domaincontrolleraddresstype
Write-host "Domain Controller Name:" $objItem. DomainControllerName
Write-host "Domain GUID:" $objItem. Domainguid
Write-host "Domain Name:" $objItem. DomainName
Write-host "DS Directory Service Flag:" $objItem. Dsdirectoryserviceflag
Write-host "DS DNS Controller Flag:" $objItem. Dsdnscontrollerflag
Write-host "DS DNS Domain Flag:" $objItem. Dsdnsdomainflag
Write-host "DS DNS Forest Flag:" $objItem. Dsdnsforestflag
Write-host "DS Global Catalog Flag:" $objItem. Dsglobalcatalogflag
Write-host "DS Kerberos distribution Center Flag:" $objItem. Dskerberosdistributioncenterflag
Write-host "DS Primary Domain Controller Flag:" $objItem. Dsprimarydomaincontrollerflag
Write-host "DS time Service Flag:" $objItem. Dstimeserviceflag
Write-host "DS writable Flag:" $objItem. Dswritableflag
Write-host "Installation Date:" $objItem. InstallDate
Write-host "Name:" $objItem. Name
Write-host "Name Format:" $objItem. NameFormat
Write-host "Primary Owner Contact:" $objItem. primaryownercontact
Write-host "Primary Owner Name:" $objItem. Primaryownername
Write-host "Roles:" $objItem. Roles
Write-host "Status:" $objItem. Status
Write-host
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.