Questions tagged [powershell-v3.0]

For issues relating to Windows PowerShell, version 3.0.

Windows PowerShell Microsoft's task automation platform for Windows, and includes a command-line shell and scripting language. PowerShell was designed especially for system administrators.

Powershell 3.0 comes with Windows 8 and Windows 2012 as a built in package.

73 questions
4
votes
2 answers

How to filter the Windows Security event log by SID?

I want to filter the event log for a certain user, but I don't think there's an option to search by SAMID. There is a filter by UserId though, according to here. Is the following correct syntax correct to search the user in the screen shot…
Old Geezer
  • 397
  • 8
  • 25
4
votes
1 answer

What happens when User's UPN Suffix is not Trusted in Active Directory

I have 1275 UPN Suffix in the AD. This is the maximum allowed in Windows Server 2012. $domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain(); $domaindn = ($domain.GetDirectoryEntry()).distinguishedName; $upnDN =…
4
votes
2 answers

Determine filterable attributes of returned Powershell object

Often when I'm scripting, I will be trying out a command but will want to filter the results. In order to find out what I'm able to filter on I need to know what filterable attributes are going to be available. For example, I want to get a list of…
john
  • 1,995
  • 2
  • 17
  • 30
4
votes
1 answer

Powershell script to import CSV to AD

In attempts to automate a few things, I've come across a stumbling block with an import script for AD. A part of the script contains: New-ADUser -Name $Name –GivenName $Person.givenName –Surname $Person.sn –DisplayName $Name –SamAccountName…
Cold T
  • 2,401
  • 2
  • 17
  • 29
3
votes
3 answers

Remote Powershell not working but test-wsman does

I need to script some routine task to execute remotly from a serverA to many hosts but a couple of them fail to execute the script. If i execute this: $cred = Get-Credential myUser Invoke-Command -ComputerName serverB -ScriptBlock{gci d:\}…
3
votes
2 answers

Howto check if a powershell command succeeded or not?

Is it possible to check if a powershell command succeeded or not? Example: Set-CASMailbox -Identity:blocks.5 -OWAMailboxPolicy "DoNotExists" caused the error: Outlook Web App mailbox policy "DoNotExists" wasn't found. Make sure you typed the…
3
votes
2 answers

Powershell: Single Script to "clean" multiple folders of files older than

I would like to create a maintenance script that would run on each of our servers to clean out common drop/archive directories. Preferably the script would use a reference file for the folder path and desired aging limit. Then the script would…
MaCuban
  • 94
  • 1
  • 1
  • 6
3
votes
1 answer

Possible to upgrade PowerShell 2.0 to 3.0 without a reboot?

Is it possible to upgrade powershell without reboot from 2.0 to 3.0 using Windows Server 2008?
RayofCommand
  • 1,451
  • 8
  • 26
  • 36
3
votes
2 answers

How do I "catch" a failed command that doesn't work with try...catch?

I'm running the following script that fails for a mailbox that doesn't exist Set-MailboxDatabase rdb16 -AllowFileRestore:$true Mount-Database rdb16 $stats = Get-MailboxStatistics -Database rdb16 ForEach ($item in $stats) { try { get-mailbox…
makerofthings7
  • 8,911
  • 34
  • 121
  • 197
3
votes
2 answers

Unattended Install of Windows using Powershell and Hyper-V

Is this possible? I have a script that gets up to the point of Installing Windows Server 2008. However it gets up literally to the "Click Next......etc etc..." and I want to be able to integrate this into my powershell script IF it's even…
user57862
3
votes
1 answer

How to find the printer driver properties

I have 15 print servers in our environment in different offices. Before upgrading of drivers i would like to display a report with the below information. 32 or 64 bit and Driver last installed or upgraded date. Any help will be…
2
votes
3 answers

Get-ADUser over multiple OUs and filter results

This script is supposed to grab users from several OUs and assign the users to one variable, then it takes the users from that variable and filters through each one based on last logon dates over 30 days of age. Then it exports to a CSV with some…
2
votes
2 answers

Powershell New-SMBShare not running as expected in script

I am working to move some files from one physical drive to another in large group of Windows 2012 servers. The drive letters and sizes are all the same on these servers. Basically we have a share on each server and I want to move that data and share…
YEMyslf
  • 121
  • 3
2
votes
1 answer

New-ADGroup with Multiple -OtherAttributes?

Keep getting "The Paramater is Incorrect". I think I'm following Microsoft's method correctly, but it's not working. New-ADGroup -DisplayName $name -Name $grpName -Server server.org ` -Path:'DC=server,DC=org' -GroupCategory Distribution ` …
user3413377
  • 21
  • 1
  • 3
2
votes
2 answers

powershell format a value that's already a string

I have some values that I want formatted in a specific way. To be very clear, its an IP address octet and I want it in a "xxx" format. For example if I have a octet value of "20" I want to display it as "020" not "20". I'm ultimately going to have…
Eric C. Singer
  • 2,329
  • 16
  • 17