An interactive shell, scripting and programming language, and surrounding environment from Microsoft. Commonly used by system administrators managing Microsoft software (including Windows, Exchange, SharePoint, and cloud services Azure and Office 365), PowerShell is included by default with Windows, ...

learn more… | top users | synonyms (1)

2
votes
2answers
75 views

Active Directory PowerShell Script select field and add to another field

I'm trying to come up with a script to take a field from a user (OfficeNumber) in AD and move it to another user field (HomeNumber) proceeding by an 800 number. So essentially what we are doing is ...
0
votes
0answers
35 views

Windows Server 2012: Dump local security setting to a txt file

Is it possible to dump the local security settings to a txt file using PowerShell or a batch script?
1
vote
1answer
30 views

Delete all files which contain a string & is a specific size in Powershell

I need a script that looks at a directory, select the ones that has a string in its content and is "8" in length(size). I've tried to do this like that, but somehow it doesn't work. Any tips? ...
1
vote
1answer
52 views

Find Stale/Inactive Exchange Mailboxes

Hoping someone can help with this/it's an easy to explain issue, but basically I'm looking to find mailboxes in our Exchange 2010 environment that haven't been logged into for more than x days/a ...
1
vote
0answers
48 views

Powershell command works in local PS prompt, but not in a remote PS prompt

I am just beginning to use PS Remoting to administer servers but have run into a snag. When I am at the local server command line, I can run a command like Get-DfsReplicationGroup and the prompt ...
2
votes
0answers
75 views

Get-WmiObject Win32_PerfFormattedData_Tcpip_NetworkInterface results in 'Invalid Class' error

On of my Nagios plugins to monitor the network load gives me problems on one Windows 2008 R2 server (out of 600). You can download the plugin here: ...
0
votes
0answers
86 views

Run logon command as administrator Windows 10

I've looked around and couldn't find a answer to this exact question. I am working on building a Windows 10 image to push to a bunch of computers using Clonezilla and I am trying to get the unattend ...
1
vote
1answer
38 views

Generate Last logon report exchange server powshell

With this command in shell get-MailboxStatistics -Server servername | Select-Object DisplayName | Sort LastLogonTime -Descending | Export-csv c:\export.csv I am able to generate a full reports of ...
0
votes
0answers
34 views

windows server 2012-R2 : how to do vpn client and server via script?

On linux I can write two scripts: Server: one script (pretty simple) to set up and start ssh server, open iptables for inbound, listen for connections and allow appro access levels Client one ...
0
votes
2answers
78 views

Server 2008 R2 PS script cannot update Active Directory

I have a Powershell script that updates users attributes in Active Directory that runs just fine from the PowerShell ISE. However when I try to run the script as a scheduled task it cannot access ...
1
vote
2answers
51 views

Powershell Passing Funtion Varible for System.Net.DNS

Recently I have been working on trying to parse thru a series of servers for DNS information. I can't seem to correctly pass the variable to the function. Calling the function by itself and passing ...
2
votes
1answer
67 views

When I add users to a Security Group using Powershell, they don't show up in AD

I have a script which has the following for adding users using a CSV file, in Powershell. Windows Server 2008 R2. looks like this: Import-Csv "C:\Users\me\Desktop\users.csv" | Where-Object {$_.Name} ...
2
votes
1answer
86 views

Automatically run PowerShell script at first boot

We use Hyper-V + SCVMM to host Windows Server 2012 (R2) virtual machines. Currently our deployment procedure includes a lot of PowerShell commands that we have to copy/paste after the VMM template is ...
1
vote
2answers
71 views

Windows: Escape spaces in command

I'm trying to execute a simple command with path containing spaces $solution = "test.sln" $msbuild = "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" Exec { iex "$msbuild `"$solution`" ...
0
votes
1answer
112 views

PowerShell: How to get local users and local groups, but exclude disabled accounts

I got a PowerShell command that gives me a list of users and the groups those users are members of. The only problem is that is gives me every user including those that are disabled. I need to be ...
1
vote
1answer
64 views

Associate a Public IP in an Azure Resource Group to a Web App?

I'm playing around with Azure Resource Groups. I've created a group, and in it, I've created a web app. (This is all just academic and I'll delete it all when I'm done leaning, so I don't mind ...
1
vote
1answer
60 views

Remotely change local group policy server 2008R2

I'm trying to find a way I can edit the 'trusted hosts' list under local group policy remotely. Path from within Local Group Policy is: \local computer policy\computer configuration\administrative ...
0
votes
0answers
37 views

New admin account cannot remote powershell in

I have provisioned a new Azure VM which deploys with 1 admin account, which I can use externally to create a remote Powershell session to the VM. If I RDP onto the VM, create a new user which is a ...
0
votes
0answers
53 views

Silent SQL Server install through Powershell fails with Access Denied

When using a remote Powershell session, logged in as the system admin account, to do a silent install of SQL Server 2014, it fails with: Message: There was an error generating the XML ...
0
votes
0answers
29 views

Configuring IIS 7 SMTP settings via powershell

I need to touch up the list of IP addresses that can relay through my SMTP virtual server in IIS. I've been trying to get a handle on what cmdlets and to use in my script but am struggling a bit. ...
0
votes
2answers
52 views

Powershell split-path formatting

I'm having some issues on some of the formatting. My code looks for the new files in a folder structure and returns those items, but I would like to trim the result to only show the first 3 folders ...
0
votes
1answer
67 views

Move emails older than x date to deleted items folder via powershell

I am trying to move e-mails older than 1 year, or any date for that matter, to the deleted items folder via power shell. I've tried running : Get-Mailbox -Identity myuser | Search-Mailbox ...
4
votes
2answers
438 views

Install .NET 4.6.1 remotely via powershell

I am trying to remotely install .NET framework4.6.1 on a large group of machines. I'm using powershell to remotely script this. The problem is that for whatever reason the .exe does not seem to want ...
2
votes
1answer
70 views

Azure Resource Manager Security rules implementation with powershell

I've been trying to push Azure NetworkSecurityGroup rules through powershell. Using the console I seem to be able to create what I want, however using powershell I am having little success. Using ...
0
votes
1answer
55 views

linked mailbox ADSI Edit

I have a clean up task to do with my Exchange 2003/07 environment. The set-up is as follows: domain controllers - ( 2003, 2012, 2008) Domain Function Level is: Windows Server 2003 Server 2003, ...
0
votes
1answer
26 views

Pass arguements as parameter to -filterXPath get-wineventLogs

Hi I made powershell script in which I am taking three arguements(in param block) and passing them as parameters to -FilterXPath. But I am not able to get the result. $eventID=7036 $ServiceName=PW ...
0
votes
2answers
74 views

How do I query (uniquely) the current user's information from Active Directory?

How do I query the current user's information from Active Directory? I know that I can access a lot of information about the current user from Windows, such as environment variables and the like. I ...
0
votes
0answers
40 views

execute powershell script even if he is already running

I have a powershell script that is scheduled to run when an user account is disabled in Active Directory. My problem is that when i'll use a script in order to disable multiple user accounts (for ex. ...
0
votes
0answers
21 views

Needed permissions to read msDS-ReplLinkFailures attribute

I'm using powershell to get the value of msDS-ReplLinkFailures attribute like this: Get-ADRootDSE -Properties msDS-ReplLinkFailures This works ok if the current user is member of domain's ...
3
votes
2answers
47 views

How can I check group membership when an user account is deleted ?

I have a scheduled task which executes a PowerShell script when an user account is deleted from Active Directory. Is there a way to check the group membership of that user account ? I have tried with ...
0
votes
1answer
172 views

The server was unable to process the request due to an internal error with Powershell

The server was unable to process the request due to an internal error I ran into the below error message when running the Get-ADPrincipalGroupMembership account Powershell commands for certain user ...
0
votes
2answers
50 views

Powershell ForEach Loop spitting out badly formatted samAccountName

I am attempting to take a list of account names from a group and then create a file in each of their home directories. But the problem I run into is everytime instead of getting the account (e.g. ...
0
votes
0answers
68 views

Dynamics CRM: Get-CrmSetting SSL/TLS error

I am getting an error when trying to enable Tracing in one of our servers. Commands used: Add-PSSnapin Microsoft.Crm.PowerShell Get-CrmSetting TraceSettings Error: Get-CrmSetting : The ...
0
votes
0answers
88 views

How to send an email with Powershell that doesn't end up in spam folder to Gmail?

I have various PowerShell scripts on Windows Server 2012 R2 that I like to notify me via email upon completion, so I setup a local SMTP server that is restricted to 127.0.0.1 only, and use this ...
3
votes
1answer
48 views

Windows Server firewall track connection state

I am trying to control a Windows Server 2012 (R2) firewall by using PowerShell commands (see https://technet.microsoft.com/en-us/library/hh831755.aspx#BKMK_ProfileGlobalDefaults for example and ...
1
vote
1answer
74 views

Knife not parsing JSON variable in PowerShell

I am trying to create an amazon EC2 instance using "knife ec2 server create" and passing in JSON to override the default settings by using the -j option where $json is properly formed JSON text and I ...
0
votes
1answer
172 views

How to assign an IP for Hyper-V virtual machine using PowerShell?

I'm working with the Hyper-v and have created a VM using Vagrant. Seems to be in the Vagrantfile I've forgotten to define an IP address (static or dhcp use). Now I can view the info about the VM's ...
0
votes
0answers
207 views

Get-AzureService : ForbiddenError: The server failed to authenticate the request

I am using azure workflow on azure automation and get the template from Azure gallery for "connect the azure using subscription certificate". After Create the connection "Azurec" and upload the ...
0
votes
1answer
37 views

Change passwords for schedule Tasks Daily

I need to schedule a health check script on a particular domain controller , have the service account, everything works. Unfortunately due to firewalls, this script can only be run on a DC, which ...
0
votes
0answers
21 views

Why does Read-SCVMHost fail when an unrelated host cannot be read?

In SCVMM 2012 R2 Rollup 7, I had an issue with a certain Hyper-V host (host1) which was on a cluster with another host (host2). When running Read-SCVMHost -VMHost host2, the command failed with the ...
2
votes
1answer
129 views

instanceType attribute in Active Directory

I need to change the instanceType attribute of a service account. If I try to change it from Active Directory Users and Computers console it's greyed out and if I try to change it via powershell with ...
2
votes
1answer
77 views

Use Windows PowerShell to find and delete files from specific owner

Because of a ransomware attack (no big deal, all recovered from backup) I want to clean up the directories and sub directories on the network share where the attack happened to create a lot of ...
0
votes
0answers
19 views

powershell select previous days IIS log file

I am trying to select the IIS log file from the previous day to search it. The command I am trying to use to select the set the date format so I can then select the file is: (get-date).addDays(-1) ...
1
vote
1answer
127 views

Wevtutil equivalent for powershell script to get event logs

I have made a powershell script which is as below but since I won't be able to save it in .evtx format. I want the wevtutil equivalent(using wevtutil epl) for the same.Please help! ...
1
vote
1answer
99 views

The term 'New-RemoteMailbox' is not recognized as the name of a cmdlet

Trying to create the new remote mailbox for O365 (on-premis mailox does not exists). I'm establishing connection to local Exchange server (either by EMS or by Invoke-Command PowerShell) and try to ...
1
vote
1answer
164 views

PowerShell - Set-RemoteMailbox to move to Office365 - object couldn't be found

I'm trying to create an online mailbox for existing Exchange 2010 user. This user is present in AD for sure. To do this I'm trying to use command like: Set-RemoteMailbox 'userE-mail' Though, I'm ...
0
votes
4answers
283 views

Azure : Script to start or shut down multiple VMs

Is it possible to write and save some kind of script that launches azure powershell, then authenticate azure subscription then start/shutdown multiple VMs in one step? I have 5 VMs that I use ...
1
vote
1answer
81 views

WMIC Command works, but doesn't work in powershell script

#Get Data Rate wmic "/OUTPUT:'C:\Users\user\Documents\DATE RATE\Data_Rate-ts8"+".txt" nic where 'NetEnabled = True' 'get Name,MacAddress,Speed'" Running this in the console directly works. That is ...
0
votes
0answers
33 views

Get-BPAModel returns index was outside the bounds of the array

Have an issue running BPA scans on Server 2012 R2 from server manager, task would fail (BPA scan did not complete) but refreshing the BPA view would yield completed scans nonetheless (for ...
1
vote
2answers
59 views

How to get Ad Domain name in my forest

I have a big forest with many AD Domain, and frequently add new domains. I need a list of these Ad Domain to query each DC.