Tagged Questions

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)

0
votes
1answer
420 views

Powershell Script not working

I have this scripts that should move Computers based no their subnet, but I keep on getting the following error and I can't for the life of me find the problem. I can manually move computers using ...
2
votes
3answers
734 views

PowerShell Import DnsShell Module

So here's the list of available modules in this directory. As you can see DnsShell is there. PS C:\windows\system32> Get-Module -ListAvailable Directory: ...
2
votes
2answers
229 views

How can I set an arbitrary (non default) attribute for an AD user or AD Contact?

I have AD Users, or contacts that are not Exchange Mailbox users, or contacts. I also have a SSO system (Ping Identity... technology similar to Microsoft ADFS), where it leverages the AD Schema ...
4
votes
3answers
1k views

How can I disable a scheduled task using Powershell?

I have a web application that runs on Windows Server 2008 R2, which has a large number of scheduled tasks which take care of all the backend stuff. When I do a software deployment which touches the ...
0
votes
2answers
129 views

non-GUI connection to local Hyper-V VM without network

I have a virtual machine on Hyper-V manager (Windows 2008 R2) without a network configured on the VM. From a powershell script running on the host Windows server, I would like to query into the OS of ...
1
vote
2answers
1k views

PowerShell - finding users who are Inactive AND not disabled

I wrote this cmdlet: Search-ADAccount -filter {(enabled -eq $true)} -Users Only -SearchBase "ou=FirstOU,dc=domain,dc=com" -AccountInactive -TimeSpan 30 But it outputs an error: Search-ADAccount : ...
4
votes
1answer
4k views

PowerShell - Finding all of users' group memberships and kicking it out of them

as title says, I have to find all the groups that the user is a member of, and deleting its membership from all of them. I've tried this: get-adgroup -filter * | where {(Get-ADGroupMember $_ | ...
2
votes
2answers
2k views

PowerShell - Limit the search to only one OU

Ive got this cmdlet and I'd like to limit the results to only one OU: Get-ADUser -Filter {(Enabled -eq $false)} | ? { ($_.distinguishedname -notlike '*Disabled Users*') } Now Ive tried to use ...
3
votes
3answers
2k views

PowerShell script that should find disabled users that are not in a specific OU outputs users from that OU as well

Hey I've got this cmdlet here: Get-ADUser -filter {(distinguishedName -notlike "Disabled Users") -and (enabled -eq $false)} -searchBase "ou=FirstOU,dc=domain,dc=com" I've built it to find disabled ...
1
vote
1answer
230 views

Trying to list out Web services, Web sites, and App Pools - Windows Server 2003

I am curious on how i would list out Web services, Web sites, and App Pools to a .txt file on a Windows Server 2003 machine. I have Powershell 2.0 configured and have been trying to run some scripts ...
1
vote
1answer
236 views

Turn Windows Features on or off, Windows 8, Windows Batch File

I am looking to produce a batch script that turns on a number of Windows Features as the same routine is currently performed on multiple machines, an example of this would be... Turn on Default ...
0
votes
1answer
31 views

Powershell waiting for more parameters when asking for all users from a specific OU?

I want to get all the users from OU "myusers" so I have this cmdlet right here: get-aduser -filter * -searchbase"ou=myusers,dc=domain,dc=com" But when Im running it, powershell prints a >> ...
0
votes
1answer
845 views

script to list user's mapped drive not giving results or error

We are in the process of migrating two file servers to a new server. We have mapped drives via user group in group policy. Many users have manually mapped drives and we need to find these mappings. ...
2
votes
2answers
197 views

How do I install and use the cli53 tools on Windows?

I'm trying to find the simplest way to import a large number of BIND zone files in to Route 53. I've had a quick look at the AWS CLI and AWS Tools for Windows PowerShell but they don't seem to include ...
2
votes
1answer
206 views

How to set RDS security layer in Windows Server 2008 R2 via PowerShell

I'm looking for a way to set security layer setting in Windows Server 2008 R2 RDS via PowerShell (other ways to do in programmatically will do also but PowerShell is preferable). Via GUI it can be set ...
0
votes
1answer
894 views

Powershell - check if all users in a specific OU are disabled, disable if not

I tried to search for it but I didn't find anything. Could someone help me out with an example of a script that would do this?
2
votes
1answer
311 views

How to setup a daily report of the top e-mail senders in Exchange 2010

We have had issues with compromised Exchange accounts sending a large amount of unsolicited e-mails out. We have mitigated this by using a cloud e-mail gateway that does a better job in detecting ...
2
votes
2answers
722 views

How do I combine two Powershell outputs so that command #2 is run on each output?

I want to combine the commands Get-user and get-casmailbox so that I can get the "Company" from the first output, and the "ActiveSyncStatus" in the latter into a single output. I also understand that ...
2
votes
1answer
101 views

Execute ps1 script when CPU threshold is meet

I'm looking for a function similar to Debug Diagnostics Collector. Where you can setup a performance (or any counter) trigger (eg. above 50% CPU over 50 seconds). Once condition of a trigger are ...
1
vote
0answers
1k views

RDS installation failure on 2012 R2 Server Core VM in Hyper-V Server

I'm currently installing a test-bed for my firms Infrastructure replacement. 10 or so Windows/Linux servers will be replaced by 2 physical servers running Hyper-V server. All services (DC, RDS, SQL) ...
1
vote
1answer
84 views

Powershell and DfsrConfigurationFromAD - how to check all servers are updated?

I have two Win2012R2 servers (SERVER1 and SERVER2) that uses DFS Replication for keeping a couple of folders synchronized. Using the following Powershell-script that i run on SERVER1 I disconnect it ...
4
votes
3answers
696 views

How can I create a windows shutdown script from powershell/command-line?

I've read the TechNet pages that describe using computer/user startup/shutdown scripts, and that's great, but I'd like to create those scripts via the command-line (and not have to click around in ...
0
votes
3answers
1k views

How to change default install path for Notepad++ in Powershell silent/unattended script

I cant figure out the parameter(s) to change the default install path C:\Program Files\ of Notepad++ to the drive I want it to install to when I run my PowerShell script. I am trying to do a silent ...
18
votes
3answers
1k views

How do I delete this orphaned Active Directory computer object (preferably with PowerShell)?

I'm working from a Windows 7 workstation, with PowerShell v2.0, and trying to delete a particular (orphaned?) object from the LostAndFound container in a 2008 R2 FL forest and domain with the Active ...
11
votes
8answers
2k views

Expire Files In A Folder: Delete Files After x Days

I'm looking to make a "Drop Folder" in a windows shared drive that is accessible to everyone. I'd like files to be deleted automagically if they sit in the folder for more than X days. However, it ...
0
votes
1answer
97 views

Delete files except ones created on sundays with in last 4 weeks

I have a script that copies some files around and deletes older files from destination. right now it just deletes everything older than 10 days. to increase backup retention we need to keep files that ...
5
votes
4answers
224 views

powershell vs GPO for installation, configuration, maintenance

My question is about using powershell scripts to install, configure, update and maintain Windows 7 Pro/Ent workstations in a 2008R2 domain, versus using GPO/ADMX/msi. Here's the situation: Because ...
0
votes
1answer
178 views

Where can I get a list of KQL properties available in the Search-Mailbox -SearchQuery in exchange 2010?

Where can I get list of KQL properties available in the Search-Mailbox -SearchQuery Commandlet for Exchange 2010. A few I know of are subject:, body:, sentOn:, but I can't seem to find a ...
1
vote
1answer
585 views

Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps'

I've tried re-installing SQL Server 2014 and I'm still getting the following error message when trying to import-module sqlps. The same registry key exists but is appended with 120. I'm able to use ...
2
votes
1answer
226 views

How to detect if there is any file added in a folder in Windows?

Is it a way to detect if there is any file added in a folder? Include the sub-folder. For example, check if any text file *.txt is added in folder c:\data-files\ or its sub-folders. The folder can ...
0
votes
2answers
443 views

KQL Query to specify date range for Mailbox search?

I'm trying to verify some phone numbers using our exchange server with the following query to send the results to my inbox: Get-Mailbox | Search-Mailbox -SearchQuery “Body: '*XXX-XXX-XXXX*' OR ...
0
votes
1answer
145 views

finding guestid in offline documentation?

I have a little question thats been bugging me lately. I am using PowerCLI to create a new VM and I want to use the -guestId parameter to specify the Guest OS. Is there any built in documentation ...
2
votes
1answer
1k views

Powershell - Test user credentials in AD, with password reset

I can successfully use Powershell to tell if a user authenticates in Active Directory: Function Test-ADAuthentication { param($username,$password) (new-object directoryservices.directoryentry ...
3
votes
1answer
251 views

Configure Exchange to ignore requests for read receipts on certain mailbox

We have an Exchange (2010) mailbox that is automatically monitored by a windows service, this service connects to the mailbox periodically using Exchange Web Services 1.1 and imports the emails into ...
2
votes
1answer
70 views

How do -RetentionDays and -MaximumSize parameters work in Limit-EventLog in PowerShell?

I want to increase the size of the Windows Application Log using Powershell and intend to use Limit-EventLog. I must keep at least 7 days of logs and have plenty of disk space (at least up to the 4GB ...
2
votes
1answer
298 views

Can I use the GroupPolicy PowerShell module on non-AD standalone servers?

I am trying to use the GroupPolicy PowerShell module to manipulate and read local group policy settings on a standalone Windows 2012R2 server. When I try to execute the Get-GPOReport cmdlet: ...
0
votes
2answers
111 views

Can an encrypted credential be accessed from within a PSSession?

My local machine exists on a domain in a separate forest from the forest I administer. As a result, I use PSSessions extensively. While I have been able to encrypt my credentials and save them in my ...
1
vote
1answer
770 views

Comparing 2 CSV files in powershell exporting difference to another file

I've write this script out, and could have swore I had it giving me a Failed early this morning but now I'm getting nothing and not sure why. Basically I need to compare $SourceAddress with ...
0
votes
0answers
214 views

backup using powershell in windows 7 , 8

In windows 2008 we can use Add-PSSnapin windows.serverbackup abd use WBbackup command to back file and images. Both windows 7 and windows 8 have backup features; however there is no snapin to use ...
1
vote
1answer
258 views

Save Custom View from Event Viewer in .evtx

I have a Custom View in the Event Viewer with a couple of Event id's. I know you can save those event id's in an .evtx file to open it. This proces has to be executed manually. Now is my question, how ...
0
votes
0answers
159 views

Using Powershell (RSAT ) to get GPO from against another domain

I can't find any clear info online for what I'm trying to do, hope you can give me an answer :) I'm using a Windows 7 client (pctest) joint in a domain (domain1.intranet). I've installed the RSAT to ...
2
votes
1answer
851 views

server 2012r2: Cannot add-pssnapin windows.serverbackup

I am trying to run powershell script for backups on Server 2012 R2. I Have installed Windows server Backup feature but when try to execute Add-PsSnapin Windows.ServerBackup  I am getting error ...
1
vote
1answer
278 views

Powershell: using get-member to return object properties

I'm trying to browse all of the items in a sql server object. I'm working with a SQL server cluster and am using this code (lifted from another page) to get the values from 2 specific items. ...
3
votes
1answer
1k views

Script to export custom view Event Viewer to .evtx Powershell

This is my PowerShell script to export data from a Custom View in the Event Viewer via the XML data. set-executionpolicy unrestricted [xml]$CustomView = @" <QueryList> <Query Id="0" ...
3
votes
3answers
1k views

Adding remote machine to AD via Powershell

So I have a powershell script, Add-Computer -ComputerName $computername -LocalCredential $computername\admin -DomainName $domain -Credential domain\$username -Force -Restart So if I have a machine ...
2
votes
1answer
162 views

How can I create a VPN connection inside windows image?

Just like we can add driver packages to a windows image file can one add a vpn connection preferably thru Add-VpnConnection inside a .wim file ?
0
votes
2answers
174 views

Powershell pipe exporting to csv is loosing data

I'm trying to write a script that will take input from a .txt file of IP address. Do a reverse DNS lookup to get the hostname of the IP address and then export that data into .csv file. Here is what ...
0
votes
1answer
929 views

Strange behavior from Invoke-WebRequest in scheduled task

I'm running a PowerShell script that posts data to an internal webserver over HTTPS. The SSL certificate is not valid. I'm using [System.Net.ServicePointManager]::ServerCertificateValidationCallback ...
1
vote
1answer
218 views

Error 0x8007007e When trying to mount WinPE 5 wim in Windows 7 using Powershell

Using ADK for Windows 8.1, and the DISM cmdlets that come with them. I have WMF 4.0 installed. My machine is Windows 7 x64 SP1, and I'm trying to mount the wim using PS C:\Users\BigHomie> ...
0
votes
0answers
677 views

Parameterizing powershell parameters in scheduled tasks

I have a bunch of powershell scripts that are kicked off via scheduled tasks at various times. The script are run multiple times with different arguments. Also admins unfamiliar with scripting needed ...