Windows PowerShell ForumDiscussion on Windows Server Windows Powershell© 2009 Microsoft Corporation. All rights reserved.Mon, 30 Nov 2009 16:24:06 Zc357631a-5a8a-409c-b4ec-1423973b6f28http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/cd1b59c4-1cfb-4f00-8546-ad6bb3d4c9bdhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/cd1b59c4-1cfb-4f00-8546-ad6bb3d4c9bdDivyakumarhttp://social.technet.microsoft.com/Profile/en-US/?user=Divyakumar"EmployeeID;Size;ServerName;SAMAccount;Department;MailboxDisplayName;TotalItems;StoreName;LastLoggedOnUserAccount;LastLogoffTime;LastLogonTime”.How to get the below details in 1 powershell command ?<br/><br/><span style="font-size:11pt;color:#333333;font-family:Verdana">&quot;EmployeeID;Size;ServerName;SAMAccount;Department;MailboxDisplayName;TotalItems;StoreName;LastLoggedOnUserAccount;LastLogoffTime;LastLogonTime”.</span> <p class=MsoNormal><span style="font-size:x-small;color:#333333;font-family:Verdana"><span style="font-size:11pt;color:#333333;font-family:Verdana"> </span></span></p>Mon, 30 Nov 2009 16:24:06 Z2009-11-30T16:24:06Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e82906ec-a031-4629-b686-e39e590d9a18http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e82906ec-a031-4629-b686-e39e590d9a18Divyakumarhttp://social.technet.microsoft.com/Profile/en-US/?user=Divyakumar"EmployeeID;Size;ServerName;SAMAccount;Department;MailboxDisplayName;TotalItems;StoreName;LastLoggedOnUserAccount;LastLogoffTime;LastLogonTime”.How to get the below details in 1 powershell command ?<br/><br/><span style="font-size:11pt;color:#333333;font-family:Verdana">&quot;EmployeeID;Size;ServerName;SAMAccount;Department;MailboxDisplayName;TotalItems;StoreName;LastLoggedOnUserAccount;LastLogoffTime;LastLogonTime”.</span> <p class=MsoNormal><span style="font-size:x-small;color:#333333;font-family:Verdana"><span style="font-size:11pt;color:#333333;font-family:Verdana"> </span></span></p>Mon, 30 Nov 2009 16:23:30 Z2009-11-30T16:23:33Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/870fab41-439b-4f3a-ace4-cbfe4e41f789http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/870fab41-439b-4f3a-ace4-cbfe4e41f789TFarrellhttp://social.technet.microsoft.com/Profile/en-US/?user=TFarrellPowershell Set-Acl use without changing owner?I have a folder, and I am trying to grant full permissions to another user, like so:<br/> <br/> $Acl = Get-Acl &quot;C:\MyFolder&quot;<br/> <br/> $AccessRule = New-Object  system.security.accesscontrol.filesystemaccessrule(&quot;bobby&quot;,&quot;FullControl&quot;, &quot;Allow&quot;)<br/> $Acl.AddAccessRule($AccessRule)<br/> Set-Acl -AclObject $Acl &quot;C:\MyFolder&quot;<br/> <br/> The owner of the folder is &quot;Joe&quot;.<br/> The powershell script runs under the &quot;SyncProcess&quot; account.<br/> <br/> If Joe is the owner of the folder, the script fails with the error message:<br/> <em>Set-Acl : The security identifier is not allowed to be the owner of this object<br/> <br/> </em> If I change the owner of the folder manually to SyncProcess, then the script runs fine without error.<br/> <br/> My question is, why does Set-Acl try to change the owner?  I am not trying to change the owner, nor do I want to.  I read the script to mean, get the current Acl, add the full control permission access rule for Bobby, and then update the folder.  I don't think I am doing anything here to change the owner?<br/> <br/> if I add $Acl | fl both before and after the AddAccessRule method call, the Owner is the same in both, unchanged.  Whe does Set-Acl think the owner is changing?<br/> <br/> Thanks.<br/> <br/>Thu, 26 Nov 2009 14:28:20 Z2009-11-30T10:23:11Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/85b67c6e-b231-422c-83bd-03ebe7ced742http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/85b67c6e-b231-422c-83bd-03ebe7ced742KenSVhttp://social.technet.microsoft.com/Profile/en-US/?user=KenSVAccess is Denied error when using Invoke-Command; Getting Security Audit Failure Event 4625I am trying to run a cmdlet (<em>any </em> cmdlet) remotely on a Win2008 R2 (x64) with PowerShell 2 installed from a PowerShell 2 on a Win2003 R2 SP2 (x86).  But I cannot get past the Access is Denied error.  I don't know if I missed a configuration or what, but I have done everying I found on the net.<br/> <br/> Here is what I am trying to do: <pre>Invoke-Command -auth basic -cred $cred -computer Win2008Server -script { get-host }</pre> I created $cred like this:<br/> <pre>$pwd = &quot;P@ssw0rd&quot;<br/> $spwd = ConvertTo-SecureString -AsPlainText -Force $pwd<br/> $cred = New-object -typename System.Management.Automation.PSCredential(&quot;PRD\adminUser&quot;,$spwd)<br/> </pre> <br/> The PRD\adminUser account is a domain account which belongs to the local Administrator Group on Win2008Server.  And I added that account to a new Local Group:<br/> <pre>net localgroup &quot;PowerShell Session Users&quot; /add net localgroup &quot;PowerShell Session Users&quot; PRD\adminUser /add Set-PSSessionConfiguration -force microsoft.powershell -ShowSecurityDescriptorUI</pre> I then added &quot;PowerShell Session Users&quot; Group with Invoke and Read permission.<br/> <br/> But I am still getting this error:<br/> <br/> [Win2008Server] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.<br/>     + CategoryInfo          : OpenError: (:) [], PSRemotingTransportException<br/>     + FullyQualifiedErrorId : PSSessionStateBroken<br/> <br/> ------------------------------------------------------------------------------------------------------------------------------------------<br/> Here is what I found in the Security Event Log on Win2008Server:<br/> <br/> Security Audit Failure Event 4625:<br/> <br/> An account failed to log on.<br/> <br/> Subject:<br/>     Security ID:        NETWORK SERVICE<br/>     Account Name:        Win2008Server$<br/>     Account Domain:        PRD<br/>     Logon ID:        0x3e4<br/> <br/> Logon Type:            3<br/> <br/> Account For Which Logon Failed:<br/>     Security ID:        NULL SID<br/>     Account Name:        PRD\adminUser<br/>     Account Domain:        Win2008Server<br/> <br/> Failure Information:<br/>     Failure Reason:        Unknown user name or bad password.<br/>     Status:            0xc000006d<br/>     Sub Status:        0xc000006a<br/> <br/> Process Information:<br/>     Caller Process ID:    0xd0<br/>     Caller Process Name:    C:\Windows\System32\svchost.exe<br/> <br/> Network Information:<br/>     Workstation Name:    Win2008Server<br/>     Source Network Address:    -<br/>     Source Port:        -<br/> <br/> Detailed Authentication Information:<br/>     Logon Process:        Advapi<br/>     Authentication Package:    Negotiate<br/>     Transited Services:    -<br/>     Package Name (NTLM only):    -<br/>     Key Length:        0<br/> <br/> This event is generated when a logon request fails. It is generated on the computer where access was attempted.<br/> <br/> The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.<br/> <br/> The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).<br/> <br/> The Process Information fields indicate which account and process on the system requested the logon.<br/> <br/> The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.<br/> <br/> The authentication information fields provide detailed information about this specific logon request.<br/>     - Transited services indicate which intermediate services have participated in this logon request.<br/>     - Package name indicates which sub-protocol was used among the NTLM protocols.<br/>     - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.<br/> ------------------------------------------------------------------------------------------------------------------------------------------<br/> Here is what I did on the Win2008Server to setup:<br/> <ul> <li>Disabled UAC</li> <li>Disabled Windows Firewall</li> <li>New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name LocalAccountTokenFilterPolicy -PropertyType DWORD -Value 1</li> <li>Set-ExecutionPolicy unrestricted -force<br/> Enable-PSRemoting -force<br/> set-item -force WSMan:\localhost\Service\AllowUnencrypted $true<br/> set-item -force WSMan:\localhost\Service\Auth\Basic $true</li> <li>Reboot</li> </ul> On the Win2003 server from which I issued the Invoke-Command, I have done the following:<br/> <ul> <li>Disabled Windows Firewall</li> <li>Set-ExecutionPolicy unrestricted -force<br/> Enable-PSRemoting -force<br/> set-item -force WSMan:\localhost\Client\TrustedHosts -value *<br/> set-item -force WSMan:\localhost\Client\AllowUnencrypted $true</li> <li>Reboot</li> </ul> <br/> I think the problem has something to do with Win2008Server thinking the domain of the PRD\adminUser account is &quot;Win2008Server&quot; instead of &quot;PRD&quot;.  But I also tried to login with a local admin account, and it still gave the same error.  Is this a problem with the win2008Server not able to understand the password in the credentials?  Or is it the account name the problem?  Any ideas would be appreciated.<br/>Thu, 12 Nov 2009 04:50:36 Z2009-11-28T01:56:21Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/7aa3b7ed-1eb0-4a7f-9fd3-a92e3d552372http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/7aa3b7ed-1eb0-4a7f-9fd3-a92e3d552372Umanssonhttp://social.technet.microsoft.com/Profile/en-US/?user=UmanssonRunning Powershell script for IISHi<br/>I have a Powershell  script for IIS that I want run. I start the IIS Powershell console as administrator. Then run the command<br/>set-executionpolicy unrestricted<br/><br/>after that I right click on my script file and choose copy Copy as Path and paste it into Powershell. When the script run no error but the settings in the script are not applied. What am I missing here.<br/><br/>I have IIS Powershell installed. running Win2008 Sp2. If I manually run each line in the script everything is working. <hr class="sig">Regards Ulf Mansson MCT, MCSE www.lumagate.comMon, 23 Nov 2009 16:03:37 Z2009-11-27T02:44:41Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/f598b940-00b4-49c0-ba57-b65053f47c78http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/f598b940-00b4-49c0-ba57-b65053f47c78TFarrellhttp://social.technet.microsoft.com/Profile/en-US/?user=TFarrellRegistering SQL Minishell cmdlets in powershell v2On one box running powershell v1, I have registered and add-snapin the SQL Minishell and the SQL cmdlets work fine.<br/> <br/> On another box (Server 2008 R2) which has powershell v2 installed by default, I cannot seem to register the Microsoft.SqlServer.Management.PSSnapins.dll.  It gives the following error:<br/> <br/> ===================<br/> Installing assembly 'C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll'.<br/> Affected parameters are:<br/>    logtoconsole = <br/>    assemblypath = C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll<br/>    logfile = C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.InstallLog<br/> An exception occurred while trying to find the installers in the C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll assembly.<br/> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.<br/> Aborting installation for C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll.<br/> Rolling back assembly 'C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll'.<br/> Affected parameters are:<br/>    logtoconsole = <br/>    assemblypath = C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll<br/>    logfile = C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.InstallLog<br/> An exception occurred while trying to find the installers in the C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll assembly.<br/> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.<br/> Aborting installation for C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Redist\Microsoft.SqlServer.Management.PSSnapins.dll.<br/> ======================<br/> <br/> What is missing?  How can I install/register these cmdlets and run them from powershell v2?<br/>Mon, 23 Nov 2009 22:34:31 Z2009-11-27T00:05:59Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/44e8b282-e831-4a8b-b69f-b700737e987ahttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/44e8b282-e831-4a8b-b69f-b700737e987aPascal Meierhttp://social.technet.microsoft.com/Profile/en-US/?user=Pascal%20MeierBackUp script for HyperV VMsHi<br>I'm writing a script, to shutdown, copy (robocopy) and start VMs running on HyperV.<br>I'm looking for a command who is waiting until the previous commands completed. When I shutdown the VM I have to wait, till the VM is completely down, otherwise i get an error when the copying is starting.<br><br>Thank you for your help!<br>Regards, Pascal<br>Fri, 02 May 2008 15:02:48 Z2009-11-26T14:24:44Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/2e25756c-8d54-4302-9b0f-81d8b0d3de18http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/2e25756c-8d54-4302-9b0f-81d8b0d3de18Glaziz.Chenhttp://social.technet.microsoft.com/Profile/en-US/?user=Glaziz.ChenInsert a letter to a string.Hi, i want to insert a letter to a string.<br/>For example: if i want to insert &quot;0&quot; to ST1234567<br/>Original string:ST1234567<br/>After run program: ST<strong>0</strong>1234567<br/>How should i do?<br/>Thu, 26 Nov 2009 08:10:36 Z2009-11-27T17:07:20Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/54ec32fd-a6e7-4468-bc5c-58e88f93a7fchttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/54ec32fd-a6e7-4468-bc5c-58e88f93a7fcMatty_Chttp://social.technet.microsoft.com/Profile/en-US/?user=Matty_CemployeeType user attribute isn't available from Get-UserI'm trying to run the following Powershell script:<br/> <br/> Get-user –organizationalUnit domain.com/OU1/OU2 | where {$_.RecipientType –eq &quot;User&quot;}  | where {$_.employeeType –eq &quot;contractor&quot; -or $_.employeeType –eq &quot;temp&quot;} <br/> <br/> <br/> RecipientType works without a problem.    We need RecipientType because it is returning Users who don't have an Exchange Mailbox.    My script then takes those users and creates an Exchange Mailbox for them (not included in the script).   However, Get-User is not returning ANY data for employeeType which is wrong and this is causing my query to be empty.<br/> <br/> In other words, &quot;for all temp or contractor users (employeeType) who do not have a mailbox (RecipientType)&quot;<br/> <br/> I can confirm 100% a set of users are 'User' &amp;&amp; 'temp'.<br/> <br/> Can anyone help?  Is there another query I could use that would give the same end result?<br/>Tue, 24 Nov 2009 07:25:49 Z2009-11-26T07:28:38Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/b3b5eddb-b389-4834-8e77-f1f77328383ahttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/b3b5eddb-b389-4834-8e77-f1f77328383aAndreThompsonhttp://social.technet.microsoft.com/Profile/en-US/?user=AndreThompsonHow do I connect to AD group object via distinguished name?<p>Hi<br/><br/>I have the following code which works when I run it from a Windows 2003 DC:<br/><br/>$strTest  = ”LDAP://CN=testgroup,OU=test,DC=mydomain,DC=com&quot;<br/>$group=new-object directoryservices.directoryentry($strTest)<br/>$strMail = $group.mail<br/>$strMail<br/><br/>I want to automate it and I have the distinguised name.<br/>However, when I convert it to the following script, it does not work:<br/><br/>$myGroup = $objGroup.distinguishedname<br/>$strTest = &quot;LDAP://&quot; + $myGroup<br/>$strTest<br/>$group = new-object directoryservices.directoryentry($strTest)<br/>$strMail = $group.mail<br/>$strMail<br/><br/>What am I doing wrong? Please help.<br/><br/>Note that $strTest does output LDAP://CN=testgroup,OU=test,DC=mydomain,DC=com<br/>So this means that $group = new-object directoryservices.directoryentry($strTest)<br/>is not binding.</p>Tue, 24 Nov 2009 16:24:08 Z2009-11-26T13:10:55Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/c763900b-4489-4e90-8c8f-c432ec0897d9http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/c763900b-4489-4e90-8c8f-c432ec0897d9c0pehttp://social.technet.microsoft.com/Profile/en-US/?user=c0pecommand or function to write specified character specified number of times?Hello,<br/> <br/> what are some options for writing a specified character a specified number of times?<br/> <br/> to clarify, say I have a column width of 50 and each item I print will be less that 50 characters, but I want to fill any remaining space of that 50 that my item does not fill with a character, like a space or '-''s. For purposes of output formatting.<br/> <br/> within some loop structure I envision something like this:<br/> <br/> write-host $myItem pad('-', 50 - $myItem.length) $myValue<br/> <br/> resulting in something like this:<br/> <br/> Item1 ---------------- value1<br/> item2 ---------------- value2<br/> AnotheItem --------- anotherValue<br/> another -------------- another value<br/>Tue, 24 Nov 2009 20:24:12 Z2009-11-25T01:45:17Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/1ddfdae8-2b4a-4c2a-a723-3727040b9f4ehttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/1ddfdae8-2b4a-4c2a-a723-3727040b9f4ec0pehttp://social.technet.microsoft.com/Profile/en-US/?user=c0pegwmi questionhello,<br/> using gwmi -class win32_computersystem only returns a few of the properties that are actuall available in that class... as seen from gwmi -class win32_computersystem | gm <br/> <br/> I know I can specify $(gwmi -class win32_computersystem).PropertyName to see each one individually but how do I get it to display all of the properties in one command? <br/> <br/> thanks!Tue, 24 Nov 2009 18:18:51 Z2009-11-26T01:51:28Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/ae97c5d7-b9ad-4d8e-9f78-dccfc6a937fehttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/ae97c5d7-b9ad-4d8e-9f78-dccfc6a937fesaurabh180407http://social.technet.microsoft.com/Profile/en-US/?user=saurabh180407how to execute powershell commmand stored inside variablei have a situation where my command to e executed is stored in a variable, how do i execute that .. <div><br/></div> <div>Example</div> <div><br/></div> <div>$a = 'get-help out-file | out-file test.txt'</div> <div><br/></div> <div>how can i execute the command inside $a</div> <div><br/></div> <div> i do </div> <div><br/></div> <div>$a </div> <div><br/></div> <div>it just prints the value..</div><hr class="sig">studentTue, 24 Nov 2009 17:24:38 Z2009-11-24T18:22:34Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/05564755-c2cd-4953-af08-7959f9811723http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/05564755-c2cd-4953-af08-7959f9811723Vkakumarhttp://social.technet.microsoft.com/Profile/en-US/?user=VkakumarAdd a user into multiple groups<p>Hi,<br/><br/>I would like have a comamnd or script which I can add a user accoun into multiple domain security groups.<br/><br/>I should be able to read the group information from a file.<br/><br/>Thanks in advance<br/><br/>Regards<br/>Arun</p> <p> </p> <p>hi,</p> <p>After runnig below command in Power shell 2.0 I am getting this error</p> <p>PS C:\Arun\scripts&gt; $groups |% {add-adprincipalgroupmembership $user $group}<br/>The term 'add-adprincipalgroupmembership' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.<br/>At line:1 char:43<br/>+ $groups |% {add-adprincipalgroupmembership &lt;&lt;&lt;&lt;  $user $group}<br/><br/>I have entered command as<br/>1. $user = &quot;kumar&quot;<br/>2. $groups = &quot;groups.txt&quot;<br/>3. $groups |% {add-adprincipalgroupmembership $user $group}<br/><br/>I am not good in scripts, so sorry if Ia m doign any stupidity here<br/><br/>Regards<br/>Arun<br/>Arun</p> <p> </p> <p> </p>Thu, 19 Nov 2009 04:46:39 Z2009-11-26T05:55:52Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/4380256e-e031-4418-a4b8-64b4b3d71fb6http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/4380256e-e031-4418-a4b8-64b4b3d71fb6Jason Robersonhttp://social.technet.microsoft.com/Profile/en-US/?user=Jason%20RobersonRunning out of Memory<p>I was wondering if my issue is avoidable at all or if it were just the 'nature of the beast' per se.<br/><br/>I have to change a few attributes on millions upon millions of files in several tiers of directories. (ie. ReadOnly) I've written a script that will go through and do this recursively but after about 15 hours (around 10million files into it) powershell crashes due to lack of memory resources. I am not building any collections or storing large numbers of variables I pretty much pipe it through as I go with the theory of 'set it and forget it' so to speak. My code is below. Is there any way to optimize this so that it releases the usage memory as it goes? My box is running with 3Gb RAM.<br/><br/><br/><br/>#The scenario is each folder architecture is folder nums 1-255, each one of those has 1-255 and the same down one more level. I just created a For loop.<br/><br/><br/><br/>For ($a = 0; $a -le 255; $a++)</p> <p>{</p> <p>$filer = &quot;<a>\\cfil9904\stmts2001\home\runtime\is\files\525-2\000\$a</a>&quot;</p> <p>Get-ChildItem $filer -Recurse | Where-Object {$_.isreadonly -eq $false} | foreach-object {<br/><br/>$_.lastaccesstime = $(Get-Date &quot;01/16/2015 11:49&quot;)<br/>$_.attributes = 'Archive', 'ReadOnly'</p> <p>}</p> <p>}<br/><br/><br/>Any suggestions?</p><hr class="sig">Jason Roberson NC State Employees' Credit Union Raleigh, NCThu, 19 Nov 2009 19:47:53 Z2009-11-24T08:17:21Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/dc42317a-f095-4fe6-a6af-3b407780f388http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/dc42317a-f095-4fe6-a6af-3b407780f388Peace Lohttp://social.technet.microsoft.com/Profile/en-US/?user=Peace%20LoIs there PowerShell for Windows 2000 server - SP4?Hello,<br/><br/>I don't know if there is PowerShell for Windows 2000 server - SP4. I really need it to investigate some error.<br/>Please help.<br/><br/>Thanks,<br/>-Peace.Tue, 24 Nov 2009 04:02:46 Z2009-11-24T06:28:06Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/ba094c6a-f348-4dfb-9745-c97a9fdbb40bhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/ba094c6a-f348-4dfb-9745-c97a9fdbb40bUmanssonhttp://social.technet.microsoft.com/Profile/en-US/?user=UmanssonChange maxconnection setting in IIS with PowershellHi<br/>I need help on how to change the &quot;Maximum Concurrent Connections&quot; settings on my site in IIS with Powershell. <br/><br/>In the GUI I find the setting under &quot;Connection Limits&quot; but I don't know how to find it Powershell nor how to change it.<br/><br/>I'm running IIS7 on Win2008 SP2 with Powershell for IIS installed<hr class="sig">Regards Ulf Mansson MCT, MCSE www.lumagate.comMon, 23 Nov 2009 07:13:29 Z2009-11-24T03:24:51Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/194d8881-4db2-45b9-85f1-39be186575b5http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/194d8881-4db2-45b9-85f1-39be186575b5Keith W.http://social.technet.microsoft.com/Profile/en-US/?user=Keith%20W.Get IP and MAC addresses for all devices?I'm trying to write a script to get the IP and MAC addresses from a remote subnet and then look up each MAC in a text file to determine what kind of device it is. I can pull the address from computers using WMI or nbtstat but what I'm most interested in is oddball objects like Zebra printers which don't seem to return anything.<br/> <br/> Any way to get a MAC address back from EVERY device in a range, no matter the software running on it?<br/> <br/> Here's what I have so far:<br/> <br/> <pre>$colItems = get-wmiobject -cl &quot;Win32_NetworkAdapterConfiguration&quot; -name &quot;root\CimV2&quot; `<br/> -comp &quot;eas-testing&quot;<br/> <br/> ForEach ($objItem in $colItems)<br/> {<br/> if ($($objitem.ipaddress) -ne $Null)<br/> {<br/> $MACAddress = $($objitem.macaddress).substring(0,8) -replace &quot;:&quot;, &quot;-&quot;<br/> $MACResult = select-string oui.txt -pattern &quot;$MACAddress&quot; -list | select line<br/> <br/> $objItem | add-member -name &quot;Manufacturer&quot; -value $($MACResult.line) -membertype noteproperty -force<br/> $objItem | select IPAddress, DHCPEnabled, manufacturer<br/> }<br/> }</pre>Thu, 19 Nov 2009 22:53:02 Z2009-11-24T08:54:19Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/df92db80-65a0-4859-acac-88304de0579bhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/df92db80-65a0-4859-acac-88304de0579bc0pehttp://social.technet.microsoft.com/Profile/en-US/?user=c0pegetting your TS session ID from powershell?hello,<br/> company recently upgraded TS servers to 2k8 R2 so now, yeah, powershell :)<br/> <br/> is there a way to get my Terminal Services session ID from powershell? It would help filter out items when using things like get-process to only include 'my' processes. I'm sure there will be other scenarios that come up where getting my own sessionID will be helpful or required.<br/> <br/>Mon, 23 Nov 2009 15:12:40 Z2009-11-23T17:01:07Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/915d89dd-2600-4cea-b32e-b944da7b9f28http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/915d89dd-2600-4cea-b32e-b944da7b9f28c0pehttp://social.technet.microsoft.com/Profile/en-US/?user=c0peinclude owner in output of get-process?Hello,<br/> <br/> Is there a way to include the owner/username of a process when using get-process?<br/> <br/>Mon, 23 Nov 2009 14:59:13 Z2009-11-23T16:53:07Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/fe55c067-ae37-4d9a-a694-8148023dabf3http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/fe55c067-ae37-4d9a-a694-8148023dabf3Fawkers34http://social.technet.microsoft.com/Profile/en-US/?user=Fawkers34Showing List of printers using WPKHello<br/><br/>I've been trying out powershell with WKP, i've taken an example which lists process and want to make it list printers and their status<br/><br/> <pre>$DetectedErrorState=&quot;unknown&quot;,&quot;other&quot;,&quot;No Error&quot;,&quot;Low Paper&quot;,&quot;No Paper&quot;,` &quot;Low Toner&quot;,&quot;No Toner&quot;,&quot;Door OPen&quot;,&quot;Jammed&quot;,&quot;Offline&quot;,&quot;Service Requested&quot;,` &quot;output Bin Full&quot; $PrinterStatus=&quot;Other&quot;,&quot;Unknown&quot;,&quot;Idle&quot;,&quot;Printing&quot;,&quot;Warming Up&quot;,&quot;Stopped Printing&quot;,&quot;Offiline&quot; New-ListView -Width 350 -Height 350 -DataBinding @{ ItemsSource = New-Binding -IsAsync -UpdateSourceTrigger PropertyChanged -Path Output } -View { New-GridView -AllowsColumnReorder -Columns { New-GridViewColumn &quot;Name&quot; } } -DataContext { Get-PowerShellDataSource -Script { #Get-Process | ForEach-Object { $_ ; Start-Sleep -Milliseconds 25 } Get-WmiObject -Class $Class -ComputerName &quot;shsg-d02-prt01&quot; -Credential olympus\ap.admin |` ForEach-Object { $_.Name } } } -On_Loaded { Register-PowerShellCommand -Run -In &quot;0:0:15&quot; -ScriptBlock { $window.Content.DataContext.Script = $window.Content.DataContext.Script } } -asjob </pre> However I cant seam to get this to work, can anyone help?<br/><br/>Thanks<br/><br/>.AdamMon, 16 Nov 2009 12:01:41 Z2009-11-23T05:19:01Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/70a85748-32d1-40e6-8ea5-05fd56f6241chttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/70a85748-32d1-40e6-8ea5-05fd56f6241cRHUM2http://social.technet.microsoft.com/Profile/en-US/?user=RHUM2Powershell and graphic tools scripting<div class=body>Hello World !!<br/><br/>I want to know if it's possible to create:<br/><br/>- static dialog box with specific buttons (e.g B1 B2 B3 B4) with response (True,False,Cancel,OK,No, ...)<br/>- dynamic dialog box : when 1 new host is added to the map, a dynamic button is created in the box<br/><br/>In VBS, there are some free tools which can create automatically these requirements and associated code. <br/><br/>Are there some graphic tools in PowerShell which can do this ?<br/><br/>I want to combinate &quot;graphics windows&quot;, powershell code and internet code like HTA, HTML and so on.<br/><br/>Thanks for your ideas / help<br/>Regards.<br/>Have a nice day !<br/>RHUM2 </div>Tue, 10 Nov 2009 16:06:14 Z2009-11-23T03:21:32Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/07a70060-13b5-4e06-8ead-52ddc9399354http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/07a70060-13b5-4e06-8ead-52ddc9399354LB20http://social.technet.microsoft.com/Profile/en-US/?user=LB20Howto force a function to return a specific datatype?<p>I'm trying to create a powershell module with a function coded to return a &quot;System.Data.DataTable&quot;.  However, the resulting datatype type from the calling program's perspective is an array if multiple rows are returned or a datarow if only a single row is returned - depending upon the SQL statement used to query the db.  This presents problems with how I process the resulting variable because the methods and properties between the two possibile returned datatypes aren't the same.  Ultimately, I'd like to be able to specify that datatype returned (i.e. a DataTable) but in the end, I'd be happy if I could just force it to always be something consistent (for example, an array).  Is there any way to do this? Snippets of my code are below:</p> <p>** Calling Program **<br/>$ResultingDataTable = Get-MyDataTable</p> <p><br/>** Function defined in the module **<br/>Function Get-MyDataTable() {</p> <p>        $SQLDataAdapter = New-Object System.Data.SqlClient.SqlDataAdapter<br/>        $SQLDataAdapter.SelectCommand = &quot;Select * from Table1&quot;<br/>        $SQLDataAdapter.SelectCommand.Connection = $DB_CONNECTION_STRING</p> <p>        # create a new DataTable<br/>        $MyDataTable = New-Object System.Data.DataTable;<br/>        #fill the DataTable<br/>        $RowCount=$SQLDataAdapter.Fill($MyDataTable)<br/>            <br/>        return $MyDataTable<br/>}</p> <p>---<br/><br/>Thanks.</p>Fri, 20 Nov 2009 18:34:19 Z2009-11-22T08:35:42Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/9355df17-c312-4481-9535-636118dc8e6fhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/9355df17-c312-4481-9535-636118dc8e6fkmkiranhttp://social.technet.microsoft.com/Profile/en-US/?user=kmkiranpowershell : WCF : WebclientHi, <br/> I tried it works fine for the asmx (simple web services) but for WCf do we need to do some thing different.<br/> <br/> i just created the Simple WCF service in .net and tried to access. but was not successful. I get the server error<br/> <br/> <strong>Error:</strong> <br/> <br/> $Url = &quot;http://localhost:4637/WCFService2/Service.svc&quot;<br/> <br/> $webclient = new-object System.Net.WebClient<br/> <br/> $saopMessage = @&quot;<br/> &lt;soap:Envelope xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope&quot; xmlns:tem=&quot;http://tempuri.org/&quot;&gt;<br/>    &lt;soap:Header/&gt;<br/>    &lt;soap:Body&gt;<br/>       &lt;tem:GetData&gt;<br/>          &lt;!--Optional:--&gt;<br/>          &lt;tem:value&gt;hji&lt;/tem:value&gt;<br/>       &lt;/tem:GetData&gt;<br/>    &lt;/soap:Body&gt;<br/> &lt;/soap:Envelope&gt;<br/> &quot;@<br/> $webclient.headers.Add(&quot;SOAPAction&quot;,&quot;http://localhost:4637/WCFService2/Service.svc/GetData&quot;)<br/> $webclient.headers.Add(&quot;Content-Type&quot;, &quot;text/xml; charset=utf-8&quot;)<br/> <br/> $result = ([XML]$webclient.UploadString($Url, $saopMessage))<br/> <br/> $result<br/> <br/> Is there any other way I can pass this xml instead of passing it as a string. <br/> <br/> Regards<br/> Kiran K<br/>Thu, 19 Nov 2009 12:13:03 Z2009-11-26T05:56:41Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e0ff1c92-48fc-4c2e-9dec-db1e3bbb3ad8http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e0ff1c92-48fc-4c2e-9dec-db1e3bbb3ad8AndreThompsonhttp://social.technet.microsoft.com/Profile/en-US/?user=AndreThompsonHow do I create an e-mail distribution group without the Exchange cmdlets?Hi<br/><br/>I want to use Powershell to create a distribution group and enable it for e-mail but without using the Exchange cmdlets.<br/>I can currently do this manually on a DC when I create a new distribution group, amd when I click next, it asks me to check a box to &quot;Create and Exchange e-mail address&quot;<br/><br/>Can can I achieve this?<br/><br/>Thanks.Thu, 12 Nov 2009 20:49:45 Z2009-11-20T19:16:03Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/9885d4bf-0d2b-4d8b-ae81-18dc37c91770http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/9885d4bf-0d2b-4d8b-ae81-18dc37c91770Nick Calverthttp://social.technet.microsoft.com/Profile/en-US/?user=Nick%20CalvertGet-wmiobject – How to return multiple instances of the same property Argh, i realy cant work out how to do this, it must be, so, so simple but nothing i have tried is working. So:<br/> <br/>  <br/> gwmi -Namespace &quot;root\virtualization&quot; -class  Msvm_ComputerSystem<br/> <br/>  <br/> ...returns a list of a bunch of virtual machine objects. If i wanted to return only the property for... say... ‘HealthState’, for all of these objects, how do i do this :) Hope i make sense...Fri, 20 Nov 2009 12:46:10 Z2009-11-20T16:33:34Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/6a2eece0-dc56-4856-bd37-34a886263c0ehttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/6a2eece0-dc56-4856-bd37-34a886263c0eRandal van Splunterenhttp://social.technet.microsoft.com/Profile/en-US/?user=Randal%20van%20SplunterenCustom provider and remotingHi,<br/><br/>I want to try remoting using our custom provider (http://psbiztalk.codeplex.com).<br/><br/>I've set up two machines and configured winrm. Remoting works fine for the default providers like file system, environment, etc.<br/>Also on both machines (client and server) local usage of the provider works great.<br/><br/>In order to use our provider remote I do the following:<br/><br/> <pre lang="x-c#">Enter-PsSession -ComputerName OtherMachine </pre> <br/>The prompt switches to the remote machine, then I type:<br/><br/> <pre lang="x-c#">Add-PsSnapIn BiztalkFactory.PowerShell.Extensions</pre> Unfortunatelly I then receive an error saying: The Windows PowerShell snap-in 'BizTalkFactory.PowerShell.Extensions' is not installed on this machine.<br/><br/>I tried a couple of things but cannot find the reason for this.<br/><br/>Anyone an idea? Thanks in advance.<br/><hr class="sig">HTH, Randal van Splunteren - http://biztalkmessages.vansplunteren.net - Please mark as answered if this answers your question.Fri, 20 Nov 2009 13:24:11 Z2009-11-20T15:25:07Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/1a3a5083-f3bb-40af-b212-5fd5b14e5c40http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/1a3a5083-f3bb-40af-b212-5fd5b14e5c40kmkiranhttp://social.technet.microsoft.com/Profile/en-US/?user=kmkiranpowershell : New-WebServiceProxy : Header infoHi,<br/> After lots of search i came across the New-WebServiceProxy to genearte th proxy. Now I want to pass the Header information too. So how can I pass the header information when i am using New-WebServiceProxy.<br/> <br/> <strong>Power shell Code</strong> <br/> <br/> $zip = New-WebServiceProxy(&quot;http://foo/my.svc&quot;)<br/> <br/> <strong>Header information I want to send:</strong> <br/> <br/> <strong>Content-Type</strong> : text/xml;charset=UTF-8<br/> <strong>cookie:</strong> Logincert=iLmD3psnE4TfB9Ln4iyRSa10yC9yyg%2fwbUZLT7CjQwhu3vjYrI%<br/> <strong>User-Agent</strong> : Jakarta Commons-HttpClient/3.1<br/> <br/> <br/> Regards,<br/> Kiran K<br/>Thu, 19 Nov 2009 12:06:47 Z2009-11-26T05:56:28Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/7d868092-48d8-4d44-9194-06a88f3ba0c7http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/7d868092-48d8-4d44-9194-06a88f3ba0c7Mezreinhttp://social.technet.microsoft.com/Profile/en-US/?user=MezreinLocal Users and Groups<p>I found the document on how to migrate local users and groups to a migrationstore file, but the commands appear to be set for powershell 1.0. I need to know how to do this using powershell 2.0 on a 03 non-ad server. Any docs on it?</p>Tue, 10 Nov 2009 20:14:01 Z2009-11-20T16:36:01Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/bcde4e33-6bb9-47d4-b270-2430eeec8f80http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/bcde4e33-6bb9-47d4-b270-2430eeec8f80LLPAETEChttp://social.technet.microsoft.com/Profile/en-US/?user=LLPAETECscript can't process directories starting with a space... <p>Hello all,<br/>I have a script which purges all files and then purges all empty folders from a location.  My problem is that a lot of the files and folders are auto generated from other systems, and sometimes it just so happens that a folder or file is created with a space at the begining of its name.<br/><br/>The exact error is:<br/></p> <pre>Get-ChildItem : Could not find a part of the path</pre> <p>Here is my code, would anyone be able to assist a work around for this error?</p> <pre>$a = get-childitem &quot;\\myfileshare\share1&quot; -recurse -force $b = 450 start-transcript share1Folder_Cleanup.log #delete files older than $a $a | ` ? {$_.GetType() -match &quot;FileInfo&quot;} | ` ?{ $_.LastWriteTime -lt [datetime]::now.adddays(-$b) } | ` rm -recurse -force -whatif #delete empty folders $a | ` ? {$_.GetType() -match &quot;DirectoryInfo&quot;} | ` ?{ $_.GetFiles().Count -eq 0 -and $_.GetDirectories().Count -eq 0 } | ` rm -recurse -force -whatif stop-transcript</pre> Also, I do run into issues where a file path is simply too long to process.  Over 254 characters I believe.  Is there any way to intelligently design the script to account for this?  The script will still run regardless of all errors it encounters, i'm just hoping someone has some ideas on how to get around these two issues.<br/><br/>Any help would be greatly appreciated!<hr class="sig">nothingThu, 05 Nov 2009 21:26:25 Z2009-11-19T01:34:36Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/218a8191-e289-4944-a7f9-81caa3cc9811http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/218a8191-e289-4944-a7f9-81caa3cc9811CountryStylehttp://social.technet.microsoft.com/Profile/en-US/?user=CountryStylespeed powershell vs vbsThis is not a &quot;what is better question&quot;.  I have an eventlog based task and need to know if there is a difference in overhead between PowerShell2 and VBS.  I am thinking of both local and remote execution.<br/><br/>many thanks for good input<br/><br/>Country Style<br/>(since Tim Hortons is already taken)Tue, 17 Nov 2009 23:35:59 Z2009-11-20T22:42:12Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/dd2efafa-d133-44df-bd25-f2961d75f106http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/dd2efafa-d133-44df-bd25-f2961d75f106rischttp://social.technet.microsoft.com/Profile/en-US/?user=riscCustom Error RouteHello,<br/> <br/> Is there an event triggered when something is about to be written to the error pipeline, and can I subscribe to that some way.<br/> <br/> I would like to, for instance, send a mailmessage and then let the default errorhandling take place.<br/> <br/> Guess i could wrap the whole script in a try, catch, do stuff and rethrow statement, but something like this psuedocode would be nice:<br/> <br/> $ErrorActionPreference = {MyPreHandler($Error[-1]); Write-Error [$error[-1]}  (Where -1 is the error before its written :))<br/> <br/> <br/> I know that v2 introduced Register-EngineEvent and Register-ObjectEvent but I can't really figure out what to register for, or if it's possible at all. <br/> <br/> Just wanted to check if anyone has any ideas.<br/> <br/> <br/> Thanks in advance<br/> <br/> <br/>Wed, 11 Nov 2009 22:28:47 Z2009-11-19T01:58:42Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/fad3c807-74ad-4db5-a1ce-7dfe941bb96fhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/fad3c807-74ad-4db5-a1ce-7dfe941bb96fTome Tanasovskihttp://social.technet.microsoft.com/Profile/en-US/?user=Tome%20TanasovskiQuestion about -replaceI'm coming into powershell from a heavy perl background so naturally my first place of interest is to understand the implementation of Regular Expressions.  I see a difference in how replace works compared to how perl does it by default. <div><br/></div> <div>'test' -replace 't', 'k'</div> <div>returns the equivalent of perl's s/t/k/g instead of s/t/k/</div> <div>it's returning kesk and I want it to return kest</div> <div><br/></div> <div>How do I ensure that -replace will not do a global replace and only replace the first instance of the match?  I can't seem to find any msdn documentation on this either so any links would be appreciated.  I'm also not sure how to search within powershell to find documentation for this function/module/ (any help getting my lingo down is appreciated).  help replace doesn't give me anything.</div>Fri, 06 Nov 2009 19:03:30 Z2009-11-16T20:15:48Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/9e3cf922-4ea8-41d2-856c-3d699407b12ehttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/9e3cf922-4ea8-41d2-856c-3d699407b12ekmkiranhttp://social.technet.microsoft.com/Profile/en-US/?user=kmkiranPowershell : Internal Server Error : UploadString :I am trying to Execute the below services using System.Web.Client and I passed the SAOP message in this format.<br/> but when I say Upload String it gives me error <br/> <br/> <strong>Error: </strong> <br/> Exception calling &quot;UploadString&quot; with &quot;2&quot; argument(s): &quot;The remote server returned an error: (500) Internal Server Error.&quot;<br/> At :line:28 char:46<br/> + (new-object System.Net.WebClient).UploadString &lt;&lt;&lt;&lt; ($Url1, $saopMessage)<br/> <br/> <strong>Power shell Code:</strong> <br/> <br/> $Url = &quot;http://www.webservicex.net/WeatherForecast.asmx&quot;<br/> <br/> $webclient = new-object System.Net.WebClient<br/> #$webclient.Credentials = new-object System.Net.NetworkCredential($username, $path, $domain)<br/> #$webpage = $webclient.DownloadString($url)<br/> #$webpage | Write-Host <br/> <br/> $Url1 =  &quot;http://www.webservicex.net/WeatherForecast.asmx/GetWeatherByPlaceName&quot;<br/> <br/> $saopMessage = @&quot;<br/> &lt;?xml version = &quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br/> &lt;soap:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br/>         xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;<br/>         xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;<br/> &lt;soap:Body&gt;<br/> &lt;GetWeatherByPlaceName xmlns =&quot;http://www.webservicex.net&quot; &gt;<br/> &lt;PlaceName&gt;New York&lt;/PlaceName&gt;<br/> &lt;/GetWeatherByPlaceName&gt;<br/> &lt;/soap:Body&gt;<br/> &lt;/soap:Envelope&gt;<br/> &quot;@<br/> #$webclient.headers.Add(&quot;SOAPAction&quot;, `<br/> #                &quot;http://www.webservicex.net/GetWeatherByPlaceName&quot;)<br/> #    $webclient.headers.Add(&quot;Content-Type&quot;, &quot;text/xml; charset=utf-8&quot;)<br/> <br/> $webclient.UploadString($Url1, $saopMessage)<br/> <br/> Am I missing Some thing.<br/> <br/> Thanks,<br/> Kiran KMon, 16 Nov 2009 09:39:01 Z2009-11-19T09:06:40Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/256e493c-562a-44d3-ade4-14e315cf6af8http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/256e493c-562a-44d3-ade4-14e315cf6af8SJMryhttp://social.technet.microsoft.com/Profile/en-US/?user=SJMryHow to find total file sizes for files older than 3 monthsHi all<br/> <br/> Is there a command I can run from Powershell that will do the following:<br/> <br/> 1. Search a a directory (2TB) for files/folders older than 3 mths<br/> 2. The command will preserve the last accessed date of these files<br/> 3. Will give me the total disk usage the files/folders in step 1 are using up<br/> <br/> So in other words I need a command that will give me the total disk space used by files/folders older than 3 mths.  Is this possible with PS??<br/> <br/> Many thanks in advance!<br/> SjmryFri, 13 Nov 2009 15:54:26 Z2009-11-16T12:29:10Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/ba867ddf-6b28-4e9c-98fc-bfa8d7c1b4f3http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/ba867ddf-6b28-4e9c-98fc-bfa8d7c1b4f3Glaziz.Chenhttp://social.technet.microsoft.com/Profile/en-US/?user=Glaziz.ChenGet prime list.I want to get prime number list from 1 to 100. <div>Someone can help me and explain the codes.</div> <div>Thanks,</div>Wed, 11 Nov 2009 04:34:35 Z2009-11-16T09:05:42Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e0df8f96-be01-4a56-80ad-cad995a355dahttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e0df8f96-be01-4a56-80ad-cad995a355daGrantjo78http://social.technet.microsoft.com/Profile/en-US/?user=Grantjo78remove access to reg keyHi Guys<br/><br/>Anyone know how to remove (say builtin\users) access to a reg key. I can add persmission and deny permissions, but can't work out how to remove the user/group from the ACL list.Wed, 11 Nov 2009 02:26:32 Z2009-11-16T08:56:00Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e1eabe4c-0796-420e-b03e-dffc71760b8dhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/e1eabe4c-0796-420e-b03e-dffc71760b8djfcarpihttp://social.technet.microsoft.com/Profile/en-US/?user=jfcarpiError enabling remoting in WinXp SP3In a Hyper-V 2008 R2 Server I enable remoting using Enable-PSRemoting, or winrm quickconfig and this work ok.<br/>Also work in Win7, and I have remoting from Win7 to my Hyper-V Server.<br/><br/>I install PS V2 in a machine with WinXP SP3, and when I run winrm quickconfig (as admin) I receive<br/><br/>WinRM is configured ....<br/>WSManFault<br/>Message = Access denied<br/>Error Number: -2147024891 0x80070005<br/>access denied<br/><br/>Any help would be apreciatedTue, 10 Nov 2009 23:10:45 Z2009-11-16T08:47:37Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/2e458c6a-fb0f-49c1-8556-54254196e453http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/2e458c6a-fb0f-49c1-8556-54254196e453Kanienhttp://social.technet.microsoft.com/Profile/en-US/?user=KanienPowershell importing CSV and using psexec w/foreach<p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">I can import the csv and then confirm the values.<span style="">  </span>Here is an example:</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">PS C:\Users\davidf\Documents&gt; $list = Import-Csv &quot;batchtest.csv&quot;</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">PS C:\Users\davidf\Documents&gt; $list</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">ftpUserName<span style="">                                                 </span>HostingServer</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">-----------<span style="">                                                 </span>-------------</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">maxima1a<span style="">                   </span><span style="">                                 </span>maxima1.abac.com</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">PS C:\Users\davidf\Documents&gt; $list.ftpUserName</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">maxima1a</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">PS C:\Users\davidf\Documents&gt; $list.HostingServer</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">maxima1.abac.com</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">However, when I attempt to run this it errors:</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">PS C:\Users\davidf\Documents&gt; .\advance_suspend_batches.ps1</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">PsExec v1.96 - Execute processes remotely</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">Copyright (C) 2001-2009 Mark Russinovich</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">Sysinternals - </span><a href="http://www.sysinternals.com/"><span style="font-size:small;color:#0000ff;font-family:Consolas">www.sysinternals.com</span></a></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">Couldn't access $:</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">The filename, directory name, or volume label syntax is incorrect.</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">The code for the advance_suspend_batches.ps1 is:</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">$list = Import-Csv &quot;batchtest.csv&quot;</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">foreach($entry in $list)</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">{</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">C:\Users\davidf\Downloads\SysinternalsSuite\psexec.exe </span><a><span style="font-size:small;color:#0000ff;font-family:Consolas">\\$($entry.HostingServer)</span></a><span style="font-size:small;font-family:Consolas"> net user $($entry.ftpUserName) /ACTIVE:NO</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">}</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas">And if I run the psexec on the $list.HostingServer net user $list.ftpUserName /active:no it works.<span style="">  </span>I think my problem is that I have the double backslash and then the $ or that I'm not using the foreach correctly.</span></p> <p class=MsoPlainText style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Consolas"> </span></p> <span style="font-size:11pt;font-family:'Calibri','sans-serif'">Any help is appreciated.</span>Fri, 14 Aug 2009 22:13:01 Z2009-11-14T20:29:36Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/862b86c2-daf4-49a0-8328-eafae3934c02http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/862b86c2-daf4-49a0-8328-eafae3934c02John JYhttp://social.technet.microsoft.com/Profile/en-US/?user=John%20JYIs this possible?Hi all,<br/><br/>I need to retrieve services from 200 windows 2003/windows 2000 servers.  I know I can run get-service from local computer.  Is there a way that I can get services from these 200 servers and export to the file?<br/><br/>Thank you!Fri, 06 Nov 2009 16:57:55 Z2009-11-13T03:47:49Z