Quantcast
Channel: Windows PowerShell Forum
Browsing all 2562 articles
Browse latest View live

Dealing with Varbinary fields in Powershell

Hi,I'm trying to pull some data out of SQL Server, convert it into a DataTable, then push it back into a different SQL Server database using the SQLBulkCopy command.Varbinary fields are causing me...

View Article


Robocopy powershell script to copy files created today

I am trying to copy my backup files which are created on today to another location; seems like there is some sort of error in the script I createdRobocopy \\source \\destination /s /MAXAGE:...

View Article


How to return part of a string based on a regular expression as a string and...

I have an object that returns two fields that I want to present as output, but the second field needs to be modified to drop part of the data. The object looks like this:Parent...

View Article

How to check to see if a file is open/locked before trying to copy it

I am trying to copy a set of files and folders fomr one location ot another. It works ok, but if a file is open it generates an error. Is there a way to check to see if a file is open before trying to...

View Article

invoke-expression invoke-command msiexec syntax help.

When I execute tThe code listed below starts msiexec on the remote server yet the install never happens.$script = {  invoke-expression 'msiexec /i c:\foxit\foxit.msi /norestart /qn ALLUSERS=1...

View Article


Pipe "all" results to a file

I have a PowerShell script that is doing a bulk export of my Exchange 2010 mailboxes to *.pst files.The Script: http://gallery.technet.microsoft.com/office/Bulk-Export-Mailbox-209f9bdbI want to pipe...

View Article

Request for comment / peer review - Select-Item

Posted this yesterday:http://gallery.technet.microsoft.com/scriptcenter/Select-Item-V-10-beta-5e579fa6and I'm soliciting comments / suggestions from the community.  It's a function that implements a...

View Article

Delegate permissions to a AD group to a OU?

Hi!I am trying to figure out how to delegate full control to a group on an OU with powershell 3.0 on a server 2012. I can't even figure out what CMDlet i should use so can someone point me in the right...

View Article


How to get some one line PS codes

1) Is there power shell command that i can use to check for cpu load % and memory consumption  on a remote server. Separate lines of code for all three.2) What is the command to check this on the...

View Article


Image may be NSFW.
Clik here to view.

Add-ADGroupMember fails if a member is already in the group

I am having an issue with the Active Directory module for Powershell.  The issue is...I have a csv file that contains machine accounts in my active directory domain.  In the command below...

View Article

How to place PowerShell exception into a Win Form Text Box?

Greetings,could you help me with a question?Basically, I wrote a Win Form in Visual Studio 2010. My application opens powershell and runs a simple script. New-AdUser.....and it gives me an exception in...

View Article

[string]::join with powershell V3.0

Everything works well with V2.0 but not with V3.0$context = new-object System.DirectoryServices.ActiveDirectory.DirectoryContext(“Domain”) $dcs =...

View Article

Passing variable between scripts issue - help

script1.ps1:-------------Set-StrictMode -Version Latest$global:var1=0$global:var11=4if ($var11 -eq 0){$var1=3}else{$var1=4}Write-Host ("Value 1: " + $var1)return...

View Article


Cannot redirect Powershell output using Task Scheduler

I'm running Windows Server 2008 Enterprise x64 R2.Sample script x.ps1: (Get-Date).DateTime Write-Output "output" Write-Warning "warning" Write-Error "error"Run this in the cmd console:powershell...

View Article

How to list the total no of Physical HDD & size of each HDD

Hi Experts - I just need to pull the total no of HDD details of a server (Win 2k8 R2) and size of each HDDI used below wmi command but this command is not giving me the exact details.get-wmiobject...

View Article


Command to check for user logged into which server in a domain environment.

1) Is there a way to check for a user who's user id I know  and I want to know what server he is currently logged into ?2) Would this be different if he is using terminal server sessions ?3) I have...

View Article

Image may be NSFW.
Clik here to view.

Need a script to check for available disk space on servers.

I can't get this script to work It is supposed to  gives a pretty graphical display of disk usage. I would truly appreciate someone who can help me with this..This is the error message i'm...

View Article


Return Multi-Valued Attributes?

I am trying to dump a list of values on a single attribute. This isn't an issue for single-valued attributes. Those display just fine.$strFilter =...

View Article

Set-ADUser Issues

I am writing a PS script to update the "seeAlso" Active Directory attribute for our users.  I am having issues with the Set-ADUser command.  Here is my code:Import-Module ActiveDirectory $Emps =...

View Article

Account expiration details

HiI have below power shell command to get the list of all attribute which are required by me. But I am not getting accountexpiratondate correctly.PS C:\> Get-ADUser -Filter {enabled -eq "True"}...

View Article
Browsing all 2562 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>