Difference between revisions of "Powershell"

From MyWiki
Jump to: navigation, search
 
(57 intermediate revisions by the same user not shown)
Line 1: Line 1:
Add-PSSnapin Quest.ActiveRoles.ADManagement<br>
+
[[ AD cmdlets ]]<br>
To disconnect at the end of session : Disconnect-QADService<br>
+
[[ Add-QADGroupMember ]]<br>
$pw = read-host "Enter password" -AsSecureString<br>
+
[[ Appending to the description field ]]<br>
connect-QADService -service 'cgs-vsvr-dc02.campus.goldsmiths.ac.uk'-ConnectionAccount 'CAMPUS\da_gthom001'-ConnectionPassword $pw<br>
+
[[ Create an AD user using Quest cmdlets ]]<br>
The following are examples of configuring the ProxyAddresses atribute :
+
[[ Delete an AD user using Quest cmdlets ]] <br>
$roy = get-qaduser gthom009
+
[[ Disable account ]]<br>
$roy | set-qaduser -objectAttributes @{ProxyAddresses=@{Update=@("SMTP:roy@globomantics.com")}}
+
[[ foreach-object ]]<br>
$roy | set-qaduser -objectAttributes @{ProxyAddresses=@{Delete=@("SMTP:roy@globomantics.com")}
+
[[ Functions ]]<br>
$roy | set-qaduser -objectAttributes @{ProxyAddresses=@{Append=@("smtp:george2@gold.ac.uk")}}
+
[[ get-adGroupmember ]]<br>
The following sets the users password. <br>
+
[[ Get-QADUser options ]]<br>
Set-QADUser <user> -UserPassword “Password”<br>
+
[[ Managed Service Accounts ]]<br>
 +
[[ O365 ]]<br>
 +
[[ ProxyAddresses ]] ( Quest )<br>
 +
[[ Powershell string contains ]]<br>
 +
[[ Quest powershell to create a batch of users ]] <br>
 +
[[ Querying Sql Server ]]<br>
 +
[[ Querying mysql ]]<br>
 +
[[ Quest Active Directory and O365 ]]<br>
 +
[[ Reading a file ]]<br>
 +
[[ Remediating extension attributes ]]<br>
 +
[[ Set-Qaduser ]]<br>
 +
[[ Setting attributes with set QADUser ]]<br>
 +
[[ Simple loop ]]<br>
 +
[[ Split ]] <br>
 +
[[ String length ]]<br>
 +
[[ String concatenation ]]<br>
 +
[[ Text colour, setting ]]<br>
 +
[[ The "if" statement ]]<br>
 +
[[ Writing to a file ]]<br>
 +
[[ Windows routes ]]<br>
 +
[[ Install all modules for Azure and O365 ]]<br>
 +
[[ If a number lies between two values ]]<br>
  
'''To connect to Office365'''<br>
+
 
$O365Cred = Get-Credential<br>
+
 
$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection<br>
+
 
Import-PSSession $O365Session<br>
+
 
Connect-MsolService -Credential $O365Cred<br>
+
 
'''Unlock a specific user account'''<br>
+
http://richardspowershellblog.wordpress.com/2012/03/04/set-note-on-telephone-tab/
Unlock-QADUser DSotnikov<br>
+
http://www.coretekservices.com/2013/02/28/ad-attributes-lastlogon-vs-lastlogontimestamp
'''Get all disabled accounts'''<br>
+
  Encoding ascii or unicode : http://www.johndcook.com/blog/2008/08/25/powershell-output-redirection-unicode-or-ascii/
Get-QADUser -Disabled<br>
+
  setting up dirsync from ad to O365 http://www.codetwo.com/admins-blog/sync-premises-ad-office-365/
'''Get all locked accounts in the accounting department'''<br>
+
Get-QADUser -Locked -Department Accounting<br>
+
'''Examples of get-QADGroup'''<br>
+
  Display the description of the 'SuperAdmins' group in domain ss64Dom
+
PS C:>(get-QADGroup 'ss64Dom\SuperAdmins').DirectoryEntry.description
+
Using an LDAP search filter, display all the groups whose description starts with an 's'
+
PS C:> get-QADGroup -SearchRoot 'ss64.com/sampleOU' -LdapFilter '(description=s*)'
+
List all distribution groups in a specific OU container:
+
PS C:> get-QADGroup -SearchRoot 'ss64.com/sampleOU' -GroupType 'Distribution' ( Security ??? )
+
  Retrieve groups from a particular container that have the user usr1021 as a direct or indirect member:
+
PS C:> get-QADGroup -SearchRoot '<DN of container>' -ContainsIndirectMember 'ss64Dom\usr1021'
+

Latest revision as of 16:52, 16 December 2022

AD cmdlets
Add-QADGroupMember
Appending to the description field
Create an AD user using Quest cmdlets
Delete an AD user using Quest cmdlets
Disable account
foreach-object
Functions
get-adGroupmember
Get-QADUser options
Managed Service Accounts
O365
ProxyAddresses ( Quest )
Powershell string contains
Quest powershell to create a batch of users
Querying Sql Server
Querying mysql
Quest Active Directory and O365
Reading a file
Remediating extension attributes
Set-Qaduser
Setting attributes with set QADUser
Simple loop
Split
String length
String concatenation
Text colour, setting
The "if" statement
Writing to a file
Windows routes
Install all modules for Azure and O365
If a number lies between two values




http://richardspowershellblog.wordpress.com/2012/03/04/set-note-on-telephone-tab/
http://www.coretekservices.com/2013/02/28/ad-attributes-lastlogon-vs-lastlogontimestamp
Encoding ascii or unicode : http://www.johndcook.com/blog/2008/08/25/powershell-output-redirection-unicode-or-ascii/
setting up dirsync from ad to O365 http://www.codetwo.com/admins-blog/sync-premises-ad-office-365/