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)

1
vote
1answer
205 views

How to install RSAT on remote Windows 7 workstations using Powershell in 2003 AD

How do I install and enable RSAT tools on remote Windows 7 Workstations using Powershell? Actually this process I think has 2 parts: Installing the tools Enabling the features; How can this be ...
0
votes
1answer
133 views

How to create a shortcut to a file on Fileshare and hide the path from user

we are sharing a certain powershell script to our remote users; the powershell script wuill be hosted on the file share and the link(shortcut) to the bat file(which executed the powershell script) ...
0
votes
1answer
973 views

Export hardware specifications to a spreadsheet for Windows Server

I have a bunch of servers : Windows 2003 and 2008. I just wanted to export these hardware specs to a spreadsheet: cpus : num processors, clock speed, etc total hard disk space total used disk space ...
6
votes
3answers
6k views

Run remote powershell as administrator

Before I dive into the question, I have found several other questions that seem similar to mine, but they have not been able to solve my problem. Here are links to them: Remotely run a script ...
2
votes
1answer
882 views

Powershell VMWare Script not running from Scheduled Task

Background / Goal I am attempting to create a scheduled task that will: Run at the specified time (once) Run a PowerShell script that: Logs all of its output as a transcript Connects to my vCenter ...
1
vote
0answers
300 views

How to install Admin tools on Windows 7 and Windows XP workstations via powershell?

we have around 250 workstation(mix of windows 7 and XP SP3) ; we are delegating those users some admin tasks via task pads and they need admin tool pack(containing AD tools such as dsa.msc etc) for ...
0
votes
1answer
308 views

powershell script to move backup files

I want to zip sql bakup files and move from one directory to to another directory within a system using powershell 1.0 can you help me since am a beginner
0
votes
1answer
86 views

Pinging the hostname of the server I'm on does not reach out to DNS, responds with 'lowest' numerical IP

For example: Server: server1.contoso.com IPs present on server: Initially configured statically with 10.10.20.100, it had two additional IPs added to the same NIC, 10.10.20.20 and 10.10.20.102. A ...
0
votes
1answer
287 views

Powershell error when adding filepath

The script looks like this: $searchOU='ou=Servers,dc=mydomain,dc=NET' Get-ADComputer -filter * -SearchBase $searchOU | Foreach-Object { $server = $_.Name ...
0
votes
2answers
2k views

Powershell - How to find who is a local administrator on the servers in Active Directory

I would like some help to merge these two scripts, the first one I've made myself the other one is borrowed. How do I get these scripts merged, so I can get list of all the servers and of all members ...
0
votes
1answer
316 views

lookup file name in sql and rename file

I am trying to use a Powershell script to use the account number in a file name and re-name with the ID number from a sql database. Below is the code I am using to attempt this and I am not getting ...
5
votes
2answers
2k views

Why do weekly tasks created via PowerShell using a different user fail with error 0x41306

We have some scripts that create scheduled jobs using PowerShell as part of our application. When testing them recently, I noticed that some of them always failed immediately, and no output is ever ...
0
votes
1answer
579 views

Use SCOM 2012, WMI, or Powershell to identify all servers that have hyper threading turned off

We recently setup SCOM 2012 and deployed agents to all of our servers. We also have noticed that a number of these servers do not have hyper threading enabled, which they should. Is there any way we ...
3
votes
2answers
180 views

Can I use a powershell script to install db/website when the database is separated from the webserver?

My boss is on vacation and I'm supposed to have this installation script done by the time he returns. Unfortunately, I've realized that the script I developed won't work on the target server setup and ...
1
vote
1answer
1k views

How to start SMTP [SMTP Virtual Server #1] through powershell or command prompt

Because of some error on my server my SMTP [SMTP Virtual Server #1] stop. I wanted to create job which will run periodic timely and check the SMTP server status, If its stop then it will start it ...
2
votes
1answer
3k views

Powershell script not completing what it should do when scheduled with Windows Taskscheduler

I found a script that can delete files over X days old and changed it a bit so that i will scan different network folders to see if there are files that are older than X days. Now when i run the ...
0
votes
3answers
685 views

How to use powershell to check the location of user profile locations on the server?

Is it possible to find all the users profiles that are not on a certain server/folder using powershell and regular expressions? If so how would one go about this?
9
votes
1answer
934 views

What the heck is going on with this AD filter in PowerShell?

I recently wrote this answer and stumbled on something interesting. get-aduser -filter {-not (description -eq "auto")} | measure-object and get-aduser -filter {description -ne "auto"} | ...
1
vote
1answer
201 views

Using Powershell command New-AUDser to set -HomeDrive and -HomeDirectory

I'm trying to create a new user in AD with the New-ADUser command. When i look in the Users and Computers gui, all the parameters i've passed through powershell, is populated to correct fields, ...
4
votes
2answers
445 views

Powershell script to copy file named 'dat' from multiple folders

I am trying to copy a file named 'dat'. This file has no extension. The thing is though that under a Parent Folder 'Personal' I have 500 folders and all of these 500 folders have the 'dat' file. I am ...
2
votes
1answer
8k views

Run Elevated Powershell prompt from command-line

Is there a way to run a Powershell Prompt with Elevated privileges from a command linein Server 2012? Problem is this is 'Minimal Server Interface' mode without full server-gui installed so I can run ...
0
votes
1answer
282 views

Unable to create zip files with shell.application [closed]

The following example doesn't seem to work on my Windows Server 2008 SP2 nor my Windows 7 Pro Sp1. Command: $shellapp = new-object -com shell.application $shellapp Output: Application ...
0
votes
0answers
209 views

Querying boot order with powershell in vsphere

We have any environment with thousands of virtual desktop hosted on a vshpere hypervisor. I'm looking for a way to check the boot order in the bios of each vm to ensure they all are set up properly. ...
2
votes
2answers
239 views

Remove email addresses by policy

Is there any elegant way to remove email addresses from users using automation, Powershell or Exchange Email Address Policies? The platform in question is Exchange 2007. I would like to modify email ...
0
votes
1answer
361 views

PowerShell send-MailMessage fails: “Configuration system failed to initialize”

I am running Server 2003 x86, and I have PowerShell 2.0 installed. When I type send-MailMessage in PowerShell, I get this error: "Configuration system failed to initialize". I get a similar error ...
0
votes
1answer
1k views

Uninstalling KB2506143 (WMF 3.0) from Windows 2008R2 with Exchange 2010 SP2 doesn't work

KB2506143 was installed on Exchange 2010 SP2 machine on Windows 2008 R2. Since WMF 3.0 was installed Rollup Updates cannot be installed as they fail on starting some PowerShell scripts. Normal ...
1
vote
1answer
1k views

SQL Agent Powershell Job Failing with Non-Admin Proxy

I'm attempting to create a SQL Agent job that will run a PowerShell script that is saved on my system. However, the job fails with the following error: A job step received an error at line 1 in a ...
2
votes
1answer
1k views

Mirror directory, only purging files in destination directory older than 7 days

I would like to mirror a directory, but only delete files in the destination directory older than 7 days. Situation: - Directory A is mirrored to Directory B. - A file from Directory A is deleted ...
3
votes
1answer
2k views

Give AD Security Group Exchange Full Access Permission

My company is running Exchange 2007. From time to time, we need to open a user's Mailbox to to various tasks. Until now, we've been logging is as them and using Outlook directly. I'd like to give Full ...
3
votes
1answer
547 views

How can I automatically delete /tmp folder on shared drive?

We have a /tmp folder that people use for temporary stuff. It can be anything and any file. We want to make it so that this automatically deletes (or preferably MOVES to another folder on the same ...
4
votes
1answer
602 views

Diskpart breaking drive letters after powershell script is run

I built a script that mounts (attach) a VHD using Diskpart, cleans out some system files and then unmounts (detach) it. It uses a foreach loop and is suppose to clean multiple VHD using the same drive ...
0
votes
1answer
287 views

Robocopy Copy “For Loop”

I'm trying to create a simple script that will robocopy several folders using the command below. When one folder is done copying, it moves on to the next. Does anyone have a batch/powershell for loop ...
1
vote
2answers
610 views

Exchange 2010 - Mailbox Export much larger than actual size

I issue this command to export the mailbox of a user: New-MailboxExportRequest -Mailbox "user" -FilePath "\\server\share\user.pst" After 2 minutes or so, this file have been generated: Notice the ...
1
vote
1answer
874 views

Send mail on event log error trigger safe check frequency

I want to use powershell to alert me when an error occurs in the event viewer on my new Win2k12 Standard Server, I was thinking I could have the script execute every 10mins but don't want to put any ...
1
vote
0answers
226 views

PowerShell & FileNotFoundException : which file?

I'm trying to follow the instructions in http://technet.microsoft.com/en-us/library/gg697165.aspx, but my powershell script keeps throwing exceptions. It refers to a FileNotFoundException...but I ...
3
votes
1answer
350 views

New event log nowhere to be found after creating in PowerShell

Through PowerShell, I am attempting to create a new event log and write a test entry to it, but it is not showing up the Event Viewer. This is the command I'm using to create a new event log: ...
3
votes
3answers
4k views

Protect foreach loop when empty list

Using Powershell v2.0 I want to delete any files older than X days: $backups = Get-ChildItem -Path $Backuppath | Where-Object {($_.lastwritetime -lt (Get-Date).addDays(-$DaysKeep)) ...
1
vote
0answers
593 views

Detecting missing drivers for Hyper-V Server 2012

Assume I installed Hyper-V Server 2012. Networking is working fine. The server is locked down, only RDP is enabled. Enabling other ports may not be an option as the server is directly connected to ...
0
votes
1answer
150 views

Are there any Graphical PowerShell tools? [closed]

As a developer for the .NET platform, I like to "explore" a platform, framework or API by browsing through the API documentation which explains what everything is - everything is covered and when I ...
2
votes
1answer
321 views

Powershell enters foreach loop with null object

I'm listing all backups in a given directory: $backups = Get-ChildItem -Path $zipFilepath | Where-Object {($_.lastwritetime -lt (Get-Date).addDays(-7)) -and (-not $_.PSIsContainer) -and ($_.Name ...
2
votes
1answer
1k views

(Powershell) Method to return a list of groups where a specific user has 'write member' security

We use a piece of web-based software that users can log on to in order to manage access to shares controlled with AD groups. The list of groups a user can manage are the groups on which they have ...
8
votes
2answers
707 views

Using Diskpart in a PowerShell script won't allow script to reuse drive letter

I built a script that mounts (attach) a VHD using Diskpart, cleans out some system files and then unmounts (detach) it. It uses a foreach loop and is suppose to clean multiple VHD using the same ...
0
votes
2answers
78 views

Copying files from one machine to another

I'm currently generating documentation on one machine, and publishing it to a web server using the following commands in a script: net use "\\someShare" PASSWORD /user:username del /S /Q ...
0
votes
1answer
264 views

Create multiple snapshots on Hyper-V 2012 PowerShell all at once

In the Hyper-V GUI, it is possible to create a collection of snapshots across multiple VMs by selecting multiple VMs, then clicking Snapshot. In PowerShell on Windows Server 2012, you can request ...
4
votes
2answers
6k views

Zipping only files using powershell

I'm trying to zip all the files in a single directory to a different folder as part of a simple backup routine. The code runs ok but doesn't produce a zip file: $srcdir = "H:\Backup" $filename = ...
3
votes
1answer
336 views

Searching users by country, and have the result summed pr. country

I am trying to use Get-AQDUser to get a summed list of users per country. So far a have this $Country = Read-Host "Please Enter the country of which you want to see users " Get-QADUser ...
3
votes
1answer
314 views

Powershell script for setting password expiry

Due to mistakes by the helpdesk staff, I found that over a 100 user accounts in my company AD have been set so that their passwords never expire. To avoid the situation in which all these users ...
8
votes
4answers
13k views

How to properly add .NET assemblies to Powershell session?

I have a .NET assembly (a dll) which is an API to backup software we use here. It contains some properties and methods I would like to take advantage of in my Powershell script(s). However, I am ...
2
votes
3answers
2k views

How can I use shared functions in a remote Powershell session?

I have some Powershell scripts for setting up IIS web applications, message queues, etc. They use a set of shared function libraries we've created - so each script starts with the line . ...
1
vote
1answer
71 views

Remove content of file but not the file itself with windows scripting

How do I strip the content of a file without removing the file itself in a windows scripting environment?