Powershell

17K

Solutions

8K

Contributors

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.

Share tech news, updates, or what's on your mind.

Sign up to Post

can somebody guide me with the steps

there is management server,- company wv

i have been told to run ps1 script in windows power shell and i am told to pick from another server where  UNC path is given

how should i run the same ps1 script from companywv server

if i type in run command UNC path of different server where the ps1script is sitting , it will run on which server ?

Like from companywv vm, i type unc path path of company b wv for the ps1script

will my ps1 script run on companywv vm or company b vm where teh script is sitting

i should not click on vmwarepowercli?

any steps would help
0
Introducing the "443 Security Simplified" Podcast
LVL 1
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

I have a table in Sybase with 500k rows with three columns and I would like write to a csv file using PowerShell IO write steamer using ODBC. Any help is appreciated.
0
I'm looking for practical examples of using Offline Files WMI Provider classes in Powershell.

I am able to make simple queries in PS such as
get-wmiobject -class Win32_OfflineFilesCache

Open in new window

I believe these are "singleton class".

However I would like to make scripts involving methods like 'TransitionOnline' or Win32_OfflineFilesConnectionInfo/Win32_OfflineFilesDirtyInfo classes.  These seem to need a deeper understanding of loops or some nested class thing that I don't understand.

I'm hoping some examples will allow me to "see" how the code structure works and then I can take the examples and build/expand/understand further.  Currently I've been looking at this for a few hours and I'm still at step zero!

Many thanks for expert help

--Paul
0
I am experiencing a similar issue. I am able to run the below commands in powershell interactively, but when running through a webservice that calls the powershell and runs the same commands, it throws an error:

add-pssnapin microsoft.exchange.management.powershell.snapin ; enable-remotemailbox -identity divya43.prasad43 -remoteroutingaddress "smtp:divya43.prasad43@bmrntest.mail.onmicrosoft.com";

Error from the PowershellService is : Provisioning handler is not installed.
0
Trying to write a script to output a list of users who currently have a specific file open for use. I have the results showing proper when executed in powershell but when I read them into a string to send out in an email they all come out on a single line. I need to figure out how to get the usernames to show on multiple lines and not all in one line. I also need to figure out how to export the results as a file and attach to the same email. Any help you can offer would be great!

Two powershells:

Results.ps1
Get-SmbOpenFile | Where-Object -Property ShareRelativePath -Match "S2K" | Where-Object -Property ShareRelativePath -NotMatch "IMAGES" | Sort-Object ClientUsername | Select-Object -ExpandProperty ClientUsername

SendEmail.ps1
$body = C:\Results.ps1
Send-MailMessage -To (To address) -from (From address) -subject "Currently logged in users for $(Get-Date)" -Body "The below list of users are using the file.`n`nAttached is a more user friendly version.`n`n$body" -SmtpServer (SMTP Server)

Examples
Currently outputs like this:
User1User2User3User4User5

Desiring it output like this:
User1
User2
User3
User4
User5
0
I need to pull some information from AD using powershell.

I need

fName, lName, fullName, emailAddress, IPphone number, OU

anyone have a script I can borrow that will pull that to a CSV File?

Thanks!
0
Hi struggling to make this code work.  

$V2 = $V1.replace (‘Ab’ , ‘zzz’)


It works for Ab. But not AB OR ab

Tried
$V2 = $V1.replace ([Ab][AB] , ‘zzz’)


What do I need to do to ignore case ?

Any help appreciated
0
any powershell i can use where if i delegate a user to my calendar events

amd share my calendar with the delegate

can i run any powershell so that any responses to my meeting reuest will go to the delegate and not me.

we have mailboxes in office 365
0
Dear expert

I would like to programming using powershell the idea is in a test like this:

Text, text, Text, text, Text, text,
Text, text, Text, text, Text, text, Text,
text, Text, text, Text, text, Text, text, Text,
 
text1, Text2, text3, Text4, text5, Text6, text, Text, text, Text, text, Text, text, Text,

I was to grab the last line of text like  text5 and replace the text5 to test_weti is it possible?
0
How to check if a specific patch has been installed on all servers in the domain using command or powershell?
0
Cloud Class® Course: C++ 11 Fundamentals
LVL 12
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

HI,


In O365 how to check the mailbox size of a deleted user?

Thanks
0
Hi guys

We have an Exchange 2010 environment on Windows 2008 R2.

How do you export all of the mailboxes, their usernames/aliases but also the organisational unit that their usernames are part of into a CSV?

You already helped me export the mailboxes and their usernames, which worked great. I would like to add organisational units into that CSV also, is this possible?

Thanks for helping
Yashy
0
Dear Wizards, when I run this script (ps1) to get all members from all Distribution Groups of our Exchange 2016 Server (Win2012R2)

$s = New-PSSession -ConfigurationName microsoft.exchange -ConnectionUri http://mail.domain_name.com/powershell;
Import-PSSession $s;

$groupmember = foreach ($i in Get-DistributionGroup) {Get-DistributionGroupMember $i -ResultSize Unlimited | select Name, PrimarySMTPAddress,@{n='GroupName';e={$i.Name}} ,@{n='GroupSMTP';e={$i.PrimarySMTPaddress}} };
$groupmember | Export-Csv C:\_ListGroupmails.csv -NoTypeInformation;

Remove-Variable groupmember;
Remove-PSSession $s;
pause

Open in new window


I got this error

error.PNG
Can you please help and suggest?  Many thanks as always!
0
Team,

I am trying to replace a single string in a text file with the contents stored in an object in PowerShell.


An example of this would be :

PowerShell Object saved to Variable $content
Update Information
============

 |
------------ | -------------
Updates Last Applied | SvrUpdates

UCHMDT1

Open in new window


In this specific Example I want to Replace the "UCHMDT1" String with the entire contents of a CSV file
update.csv
Server_Name	DateOfChange	WorkDone	Description	Engineer
server1	7/17/2018	OS Update	Updated Java	test1
server2	7/17/2018	OS Update	Updated Device Drivers	test2
server3	7/17/2018	OS Update	Updated Device Drivers	test3
server4	7/17/2018	OS Update	Updated Device Drivers	test4

Open in new window


Final output I am looking for is as follows:

Final Output
Update Information
============

 |
------------ | -------------
Updates Last Applied | SvrUpdates

Server_Name	DateOfChange	WorkDone	Description	Engineer
server1	7/17/2018	OS Update	Updated Java	test1
server2	7/17/2018	OS Update	Updated Device Drivers	test2
server3	7/17/2018	OS Update	Updated Device Drivers	test3
server4	7/17/2018	OS Update	Updated Device Drivers	test4

Open in new window



Thanks in advance for your assistance with this..
0
Hi Guys

We have a + 50 Gig exchange mailbox that we would like to purge data from it.
We would like to keep 6 months max of current data and purge the rest.

My question I have would be what would be the best way in doing this that will have the least impact to my exchange environment?
IE: Should we look at creating a temp Mailbox moving 6 months of current data there and then moving the e-mail alias to it and trash the old mailbox and then recreate and move alias back?
Is there a PowerShell script that would work better etc.etc. etc.

Using OWA we have noticed that due to the size of the mailbox the server battles and lags when trying to delete mas mail this way.

Regards
R
0
We have a big problem using o365 Exchange.

1. We would like to know any auto-forwarding rule setup by end user themselves on webmail or Outlook
2. We would like to disable their ability setting up auto-forwarding, and only admin staff can do it on server side to prevent data leakage.
3. Is it possible to disable end user using powershell connecting to the o365 changing their mailbox configuration? and only admin account can do for all.
0
Hi,

I'm looking to create a new dynamic distribution list that only includes all my licensed Office 365 users, I have 2000 E3 users but the group is currently sending to 3000+ email addresses as it's including resources + shared mailboxes, can anyone help with creating this via PowerShell?
0
I have  2 questions on o365

1) if we have E3 licenses , and our mailboxes I believe will have 50 GB quota  and emails are sitting there.
so what is the advantage if we use retention policy, if we enable archive against user mailboxes in 365 portal, will user will have archive mailbox populated in his outlook

2) can I have any powershell which I can run to see which mailboxes are idle or in disabled state so I can convert to shared mailboxes

I need to have a list so I can convert them

3) if I have on premise AD and users are syncing through AAD sync to azure AD , I cant make any changes in Azure AD , it wont reflect in on premise AD
1
Options for synchronizing the GAL between three Exchange Organizations.

Hello Experts,

Is there an easy and economical way nowadays for synchronizing the GAL between different Exchange Organizations?

I know that back in the days there were super expensive and complex tools, such as MIIS 2003 and IIFP 2003. (Support finished in 2008). After that Microsoft released ILM 2007 (Still expensive and complex). Alternatively, there is a GAL Sync tool that sounds exactly like what I need, and the cost is a few hundred dollars.

But despite of these things, is there another simple tool or process that you know? or something more modern? I remember that a few years ago, what I did with a client was a PowerShell script to synchronize the directories and it was quite challenging to administer deleted users (avoid that they stay permanently at the destination Exchange Organization).

Let me know please what is the current solution that is used for this. I am interested only in sharing the directories (names and emails) between the three organizations.
1
Keep up with what's happening at Experts Exchange!
LVL 12
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

This is the normal output.

FRM
MYI
MYD
MDB
MDF
NDF
BAK
LOG
TRN
FBK
LDF
EDB
CHK
pagefile.sys

Can we transpose the above output into look like this?

FRM | MYI | MYD | MDB | MDF | NDF | BAK | LOG | TRN | FBK | LDF | EDB | CHK | pagefile.sys
0
Hi,

When I type powershell Get-AzureRmVM | select *

I get the following  on some of the fields:

NetworkProfile           : Microsoft.Azure.Management.Compute.Models.NetworkProfile
OSProfile                : Microsoft.Azure.Management.Compute.Models.OSProfile

how do I enumerate these and get the values ?

thank you in advance
power.PNG
0
Exchange shared mailbox is showing:  ExchangeUserAccountControl : AccountDisabled

It was migrated from exchange 2010 to exchange online.  I have a hybrid env. using dirsync/adconnect.  

It was shared prior to being migrated - and the user account associated is ENABLED.

Anyone ever seen this before?  I believe this is showing that the account is enabled, but that attribute is showing it "ExchangeUserAccountControl" creating a false positive on licensing reports.

Is there anyway to correct set this attribute?

Thanks Experts!
0
Hi,

I have restored an O365 user from PowerShell cmd : Restore-MsolUser -UserPrincipalName MyUSer

But after 15-30 min something keep deleting the user again and I need to restore again. What can cause that?
0
Within all of my Server 2016 Hyper-V virtual servers the color of the PowerShell window is black (and isn't blue).

This makes it difficult to differentiate between the PowerShell window and the command line window.

What can I do to make the PowerShell window always appear blue (and not black)?

Is there any way of making this change via some kind of group policy or global setting so I don't have to manually make this change on each and every virtual server?
0
Hello Experts,

Need from your expertise in PowerShell to build a script that works in Exchange 2016 and compatible if possible with all versions to delete messages or emails for only the mailboxes in a organization that received that message. We do not want to build the script that search all mailboxes because the organization is huge.

In Exchange 2010, I wrote something like below. Can you please provide me the code for Exchange 2016? Please, if possible add different conditions or options to delete messages, such as subject, body, attachment, reputation if possible, something that can be easily adjusted to any organization without coding too much.

See current code in Exchange 2010

$MSGS = Get-TransportService | Get-MessageTrackingLog -MessageSubject "This is a test" -start '05/17/2018 7:00AM'-EventId Deliver -ResultSize Unlimited
# to get all recipients and then all mailboxes
# to run a search query based on subject
$users = $msgs | select recipients -expandproperty recipients
$mailboxes = $users | sort -unique
$results = $mailboxes | Search-Mailbox -SearchQuery "received:>$('05/04/2018 11:00AM ') and subject:(`"DOC_F5839403`")" -deletecontent -force -SearchDumpster


so to recap, the script should delete the message with the condition above from mailboxes that so far received or get the email with that criteria
0

Powershell

17K

Solutions

8K

Contributors

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.