Quantcast
Channel: Windows PowerShell forum
Viewing all 21975 articles
Browse latest View live

Active Directory module for PowerShell Core 7.

$
0
0

Hi everyone!

  How to install Active Directory module for PowerShell Core 7?

  I found those but I do not know which one should I use to export users data from our domain. I need to export specific users attributes like description, displayName, initials, mail, name, sn, street, streetAddress, telephoneNumber and sAMAccountName.

PS C:\Users\Doria> Find-Module *activedirectory*

Version              Name                                Repository
-------              ----                                ----------
3.0.0.0              xActiveDirectory                    PSGallery 
5.0.0                ActiveDirectoryCSDsc                PSGallery 
2.0.0.1762           Microsoft.Azure.ActiveDirectory.PI… PSGallery 
6.0.1                ActiveDirectoryDsc                  PSGallery 
1.2.0.0              AdminToolbox.ActiveDirectory        PSGallery 
1.2                  ud-activedirectory                  PSGallery 
2.0.0.9              ActiveDirectoryTools                PSGallery 
1.5                  ActiveDirectory-ps4all              PSGallery 
1.7.0                CPolydorou.ActiveDirectory          PSGallery 
19.0.7354.0          ActiveDirectoryCmdlets              PSGallery 
0.0.5.1              SUBnet192.ActiveDirectory           PSGallery 
1.1.1                cActiveDirectory                    PSGallery 
1.0.0.9              ActiveDirectoryStig                 PSGallery 
0.1.10               BitTitan.Runbooks.ActiveDirectory   PSGallery 
0.2002.2             ActiveDirectory.Toolbox             PSGallery 
0.1.10               BitTitan.Runbooks.ActiveDirectory.… PSGallery 
1.0.0                ActiveDirectoryFever                PSGallery 
1.1.4                POSHOrigin_ActiveDirectoryDNS       PSGallery 
1.1.0.0              myActiveDirectory                   PSGallery 
1.0.4                cActiveDirectorySecurity            PSGallery 
1.0.0                CPolydorou.ActiveDirectoryLDAP      PSGallery 
0.2.0                PS.ActiveDirectoryTools             PSGallery 

PS C:\Users\Doria>

Thanks.


Doria


add email for alerting

$
0
0

  

 How could I add multiple servers to status of SSAS, and if state<> Processed send an email alert?

 Currently just one server lookup with file capture.

 Thanks.

[CmdletBinding()]

$ssasInstance = 'xxxxxx'
 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect($ssasInstance)
$database=$server.databases
foreach ($db in $server.databases)
{
$dbwriteout = $db|select name,state
$dbwriteout | Sort name | Export-Csv 'C:\cube_status.csv' -Append -NoTypeInformation
$Cubes=New-object Microsoft.AnalysisServices.Cube
$Cubes=$db.cubes
}

Script PowerShell to change AD user displayname and CN in a given OU

$
0
0
Hello everyone,

looking for script to rename displayname and cn from "surname" + "givenname" to "givenname" + "surname"  in a given OU.

Many thanks,

Looking for a Script to Gather Server Info

$
0
0

Hi, I'm wondering if it's possible to create a script that would Gather the following info from multiple servers at once (from a txt file) and generates a table with these. ??

Server name | Service Name | Status | Service Start Mode | Server Uptime | Last Reboot

Thanks

How to run cmdlet with its parameters inside a string variable?

$
0
0

Lets say I want to run below command

New-InboxRule -Mailbox johndoe -Name 'TestRule' -BodyContainsWord 'abc' -MoveToFolder 'John:\Inbox\Reports'

Is that possible to make something like below?

$para = "-Mailbox johndoe -Name 'TestRule' -BodyContainsWord 'abc' -MoveToFolder 'John:\Inbox\Reports'"

New-InboxRule $para

How to find if object is replicated or not

$
0
0

Hi family,

i am searching a methode to get if an object replicated from another DC or site, like user for exemple,

or when a do a request to a server i can detect an object if he is replicated or not.

Thanks,


Bulk Change AD logon name.

$
0
0

Hi All

Hoping someone can help as not much luck searching the internet.

I am looking to bulk change AD logon names.

Here is an example of what the login name are currently.

A123456 to change to A987654

I will need to change both SamAccountName and UserPrincipalname on around 300 accounts.

I can add this information in to a CSV file but not sure what the headers should be and also need help on what the powershell commands should be to do the bulk change.

Can anyone help?


I.T support

PowerShell Script to get AD user details from respective OU

$
0
0

#Script to get AD user details#

#Provide the OU path from which AD user details to fetch 

Import-Module activedirectory

$OUPath = Read-Host "Enter OU path for user details" 
$OUPath = Read-Host "Enter OU path again to reconfirm" 
$Userdetail = Get-ADUser -Filter * -SearchBase $OUPath -Properties *

$Userdetail | Select-Object DisplayName,samaccountName,EmailAddress,Enabled,Created,canonicalname,LastLogondate,memberof | ConvertTo-Csv | Out-File C:\Temp\tmp.csv
Import-Csv "C:\Temp\tmp.csv" | Export-Csv -Delimiter "," "C:\Temp\UserData.csv" -NoTypeInformation
Remove-Item -Path C:\Temp\tmp.csv


PowerShell Script to get recursive group members of multiple groups

$
0
0

#input the group names

Import-Module ActiveDirectory
$groups = Get-Content C:\Temp\grpinfo.txt
$list = foreach ($group in $groups) { 

Get-ADGroupMember $group -Recursive | Select-Object $group,name | Format-Table -AutoSize }
$list | Out-File c:\temp\list.txt

Configuring 'sshd_config' file for OpenSSH.

$
0
0

Hello!

  May someone help me with the DenyUsers, AllowUsers, DenyGroups, and AllowGroups settings?

  I need to configure the following scenario: no local or domain users can access the server via SSH, except those belonging to the domain group called 'sshusers'. For this case, what would be the correct configuration to be added to 'C:\ProgramData\ssh\sshd_config' file? Should be something like that?

DenyUsers *
DenyGroups *
AllowGroups domain\sshusers

Thanks.


Doria

Get-ADUser cmdlet and codepage.

$
0
0

Hi team.

  I am using Get-ADUser cmdlet from PS to export some domain users properties, but I noticed that names with accents are exported using another code page, probably. How can I avoid this?

Hope I was clear enough.


Doria

How to Get the local Group Members list with nested users (until last one) using power shell script

$
0
0

I have a requirement to get local group members list (Administrators, Remote Dekstop Users ETC..) with its nested members as well until the last one using powershell script for given list of servers.

Example: when we run the script in given list of servers, it should check for its local groups wherever members are available it should return output with the below table format until it nested groups members list.

ServerUser NameUser typeDescriptionStatusPriv groupPriv group AdminParent local groupDisplay nameCompany
Server Name*******Local/Domain*******EnabledAdministratorsLocalAdministrators   ***************

Note: Could anyone help me with the script please. 

Writing a powershell script in Azure

$
0
0

Hi All.

I will like to write as Ps script which will query some data from a SQL database, and also get some data from a blob storage account all in Azure. 

What would be the best and most secure way to do this, where I can store passwords in a key vault etc or any other secure method.

Thanks in advance.

Rights for scanner on a folder in the user home folder

$
0
0

Hello guys and girls,

I have the following situation

\\Server\Home\  Read/List rights 'this folder only' for the group DL_SCANUTIL  - This is not the problem

\\Server\Home\Username1\SCAN

\\Server\Home\Username1\Documents

\\Server\Home\Username2\SCAN

\\Server\Home\Username2\Documents

\\Server\Home\Username3\SCAN

\\Server\Home\Username3\Documents

\\Server\Home\Username4\SCAN

\\Server\Home\Username4\Documents

\\Server\Home\Username5\SCAN

\\Server\Home\Username5\Documents

Goal: For every user I want the  DL_SCANUTIL group to have modify right on only the SCAN folder in a user directory.

I this situation how would I do this with powershell? Or are there other options?


registry change

$
0
0

Hi All i want to modify the below registry values from 0 to 1 using powershell on remote servers, i have servers list in the below format. experts guide me on this, i am trying the below but i am not getting it

Server01.contoso.com
Server02.contoso.com

$ServersList = "c:\list.txt"
$SS = get-Content -Path $ServersList
foreach ($Servers in $SS ) {
Set-itemproperty -name EnableSecuritySignature -path "HKLM\System\CurrentControlSet\Services\LanManWorkstation\Parameters" -value "1";}


How to display user certificates from personal store with certificate template names ?

$
0
0

Hi !

I am trying to display template names (and later filter) for certificates from user personal store 

PS C:\Users\Administrator> Get-ChildItem "Cert:\LocalMachine\My"

    Directory: Microsoft.PowerShell.Security\Certificate::LocalMachine\My

Thumbprint                                Subject
----------                                -------
9DE44A461710C724548F8B15745F94984E781BBF  E=administrator@firma.local, CN=Administrator, CN=Users, DC=firma, DC=local
7B84F1FFF7EFFA96AB0120DD71276549666A5E54  CN=AD.firma.local

When I use Get-ChildItem "Cert:\LocalMachine\My" | Select-Object * I can see many properties but not Template name.

With mmc it is easy

Select-String - Problems with Latin characters

$
0
0

The Texto.txt file contains the content:

Tomate 1k
Macarrão 1/2K
Batata 3K
Pimentão 1K

When I do

Get-Content 'C:\Teste\Texto.txt'|Select-String "Batata"

Result

Batata 3K

But when I do

Get-Content 'C:\Teste\Texto.txt'|Select-String "Macarrão"

There is no result

I thank anyone who can help me

PowerShell Version 5.1.18362.752





Powershell ISE runs my script with out issues but regular powershell fails

$
0
0

I have a PS script which is communicating to Office 365 management API to extract logs, the script works when I run it on ISE but the same script fails with an error "Unable to connect to remove server" when I run it on PowerShell. 

I have added [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::TLS12 and $env:NO_PROXY but no luck.

Could someone please assist me on this issue?


Karthikeyan

PowerShell - ComboBox IF

$
0
0

I need to execute a command when selecting a certain comboBox value, I'm trying with the code, but it's not working

$buttonRUN_Click =
if ($comboBoxAtributo.SelectedItem -eq "Title") {
    Set-aduser -Identity $textBoxInsertLogin.text -Title $textBoxInsertValue.Text
}

Can you help me please?

Why do I get the value System.Xml.XmlDocument?

$
0
0

Hello everyone,

I facing the problem that when I run these lines:

$NIC = Get-NetAdapter
Get-NetAdapter -Name $NIC.Name | Rename-NetAdapter -NewName "$TestXML.Test.Ethernet.AdapterName"
<?xml version = "1.0" encoding = "utf-8" ?><Test><Ethernet AdapterName = "LAN" /></Test>

my LAN adapter is assigned the name "[string]System.Xml.XmlDocument.TestXML.Test.Ethernet.AdapterName" although the XML file contains the value "LAN".
Can someone explain to me why this is the case and how to solve the problem?

Cheers

Viewing all 21975 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>