|
Applying NTFS acl is very slow
I am using the following function:
# Add-AclTxt.MSH
# Add's an ACL to a file using text parameters
# Usage Add-Acl "File" "user" "Rights" ("deny")
# /\/\o\/\/ 2006
# http://mow001.blogspot.com
function Add-Acl {
Param ($folder,$user,
[System.Security.AccessControl.FileSystemRights]$Rights,
[System.Security.AccessControl.InheritanceFlags]$Inheritance="ContainerInherit,
Ob...
|
7 |
11/21/2008 4:49:16 AM |
|
Help - Credentials
Hi All,
Need some help. I need to copy some files from one subnet to another. I
can pull stuff from workstations on the other subnet using the -credentials
option with a wmiobject like:
$c = get-credential
(get-wmiobject win32_bios -computername 172.16.98.184 -credential $c).__server
I need to copy files to workstations on this other subnet and the
-credentail doesnt seem to work...
|
3 |
11/21/2008 3:28:00 AM |
|
Permissions on subfolders
How can I get the permissions of just the subfolders. If I use the
command below I get all the folders and files. and if I take off the
-recurse i only get the subfolders in the root but not the subs of the sub.
get-childitem c:\test -recurse | get-acl...
|
2 |
11/20/2008 9:42:20 PM |
|
Powershell Operators
I was stumbling on the internet about powershell script when I found
this one
get-childitem -recurse | where-object { $_.CreationTime -ilt
[datetime]::now.adddays(-120) } | move-item -destination 'C:\Documents
and
Settings\administrator\My Documents\My Scripts\Location2'
source: http://www.eggheadcafe.com/software/aspnet/29718323/moveitem-and-maintain-fo.aspx
I tried it and love it, I...
|
3 |
11/20/2008 7:01:59 PM |
|
Echo results of script to file
I have the following powershell script in Exchange 2007 to automate the
creation and deletion of AD contacts:
Code:
--------------------
Compare-Object (gc bannerdata\left.csv) (gc .\left.csv) |
%{
if ($_.SideIndicator -eq "<=") {new-mailcontact -ExternalEmailAddress "SMTP:$($_.InputObject.split(',')[1])" -Name "$($_.InputObject.split(',')[0])" -Alias "$($_.InputObject.split(',')[2]...
|
2 |
11/20/2008 6:41:15 PM |
|
Can this be written as a single line
I'm making a Powershell form and trying to get the following as a
single line
foreach($group in $user.psbase.properties.memberof)
{
$group1 = [ADSI]"LDAP://$group"
foreach-Object{$MemberList.Items.Add([string]
$group1.psbase.properties.Name)} |out-null
}
Thanks!...
|
6 |
11/20/2008 6:31:13 PM |
|
I can't seem to sign scripts on this computer...
I'm running CTP2 on various PCs, XP and Vista. One of my Vista boxes
has a weird error trying to sign scripts. It just says "Unknown Error"
and the Status Message is "No provider was specified for the store or
object" ... I have no idea what this means, can anyone help?
SAMPLE BUFFER:
PS> $cert = ls Cert:\CurrentUser\My
\4F8842037D878C1FCDC6FD1313B200449716C353
PS> $cert | fl HasP...
|
2 |
11/20/2008 6:27:43 PM |
|
LDAP Query for Exchange 2000
Hi Gang! How would I go about querying and Exchange 2000 environment using
PowerShell? This is what I have so far but it is not working.
$oRootDSE = New-Object
System.DirectoryServices.DirectoryEntry("LDAP://RootDSE")
$sLDAPLocation = [ADSI]("LDAP://" +
$oRootDSE.Get("configurationNamingContext"))
$oLDAPConfig = New-Object DirectoryServices.DirectorySearcher($sLDAPLocation)
$sLDAPQue...
|
2 |
11/20/2008 4:53:03 PM |
|
Quick question about sending DateTime to SQL Server 2005
Is there a way to send a [datetime] value to SQL Server besides a long
format string without loosing precision?
SQL Server barfs on ToString('o').
Other choices truncate after seconds.
"Update tbl set DateCol = '$($date.ToString('yyyy-MM-dd
hh:mm:ss.fff')' where DateCol is null;"...
|
3 |
11/19/2008 10:12:29 PM |
|
GET-QADuser -Homedirectory - Maybe a bug
I'm falling in love of Powershell, and of course after a while I
opened my eyes and discovered the truth
I'm playing a lot today with Get-QADuser and the homedirectory.
"Get-QADuser | fl homedirectory" does return all homedirectory <- this
is perfect
In the return values I do have 4 differents servers:
\\OR-SVR01\.....
\\costco.local\.....
\\NAS01\....
\\file01\.....
Now to fi...
|
6 |
11/19/2008 8:14:39 PM |
|
Copy Files/Directory to Multipe Locations
For example;
I Have this dir in C:
"C:\ProjectXX"
And I want to copy "C:\ProjectXX" to "D:\ProjectXX" and "E:\ProjectXX"
"F:\User002\ProjectXX" and so on..
I thought I could do it like this:
cp "C:\ProjectXX" -destination "D:\ProjectXX" -destination "E:\ProjectXX"
But that doesnt work.
I get:
Cannot bind parameter because parameter 'Destination' is specified more than
once...
|
5 |
11/19/2008 5:36:10 PM |
|
GET-QADuser properties question
My ultimate goal is to get all the properties returned by the GET-
QADuser command
Here are the 4 commands I use to reach my goal and troubleshoot my
problem
-> get-qaduser -identity user -IncludedProperties
samaccountname,usermustchangepassword | fl > c:\qad1.txt
-> get-qaduser -identity user -IncludedProperties
samaccountname,usermustchangepassword -IncludeAllProperties | fl ...
|
5 |
11/19/2008 3:06:05 AM |
|
Add-file
I am having a problem with a script. I am a amatuer at PowerShell
please drop me a life line! The script works as designed aside from
the output. The out put file looks like this:
Jordan, Hal G
TEST
Test, My
TEST
Allen, Barry F
TEST
Name followed by title on a seperate line. I what it to display in
column format:
Jordan, Hal G TEST
Here is what I have for ...
|
5 |
11/18/2008 5:22:38 PM |
|
Tab delimited output
Hi,
I was trying to help someone create a tab delimited output file.
I thought that this would work:
$objItem.name `t $objItem.title
But I get an "unexpexted token ` " as an error message.
What is the proper way to do this?
Old Dog...
|
5 |
11/18/2008 3:43:56 PM |
|
Product KeyProduct Key (volume licensing)
How using powershell and wmi script for reading Product KeyProduct Key
(volume licensing) will look. I think that it is necessary to use class
Win32_WindowsProductActivation, but here is how I do not understand...
|
4 |
11/18/2008 11:19:01 AM |
|
WMI network configuration
I am trying to change the DNS and WINS on some static computers. Here
is my script:
$computers = "192.168.5.158"
$NIC = Get-WMIObject -Class Win32_NetworkAdapterConfiguration -
ComputerName $computers | where {$_.IPEnabled -eq "TRUE"}
Foreach($NIC in $NICs) {
$DNSServers = "198.192.5.7","198.192.168.5.11"
You cannot call a method on a null-valued expression.
At line:3 char:31
+ $...
|
3 |
11/18/2008 6:07:30 AM |
|
AD / FileSystem - Move HomeFolder to ArchiveFolder
First post, first question.
I'm just starting with Powershell and QAD, and I have a lot of
fun.anyway I'm missing a concept tough
I have an AD, and want to move the home folder of diabled users to a
new place (archive)
I did create a csv file containing my disable user names:
Terminated.CSV:
Username
"user1@SkillStorm.local"
"user2@SkillStorm.local"
each of those user have a Home...
|
3 |
11/18/2008 5:51:27 AM |
|
Set-qadobject -<disabled>parameter ?
I can't find "disabled" parameter in both get-qadcomputer and set-qadobject.
Am i missing anything ?
disabled parameter seems to exist only for users. What i want is on
computers objects
...
|
4 |
11/18/2008 1:39:07 AM |
|
export-csv: Property does not include data
Hi folks..
I'm trying to produce a list of all running services (in the example below
where the name begins with 'w') and then export to CSV, also including the
list of dependent services. If I run:
gsv | where-object {($_.Name -like "w*") -AND ($_.Status -eq "Running")} |
select DisplayName, Status, DependentServices
the output to the console also shows the dependent services. Ho...
|
5 |
11/17/2008 6:32:02 PM |
|
Too many backticks
When using powershell I often need to use other CLI based tools such as
Subversion and Maven. However as these tools use the - character for some
switches as well a commas to seperate arguments to the same switch.
So in a normal cmd you would do:
mvn clean package -Pdeploy-srv41,deploy-srv42
in Powershell window you would need to do:
mvn clean package `-Pdeploy-srv41`,deploy-srv42
I...
|
11 |
11/17/2008 6:27:21 PM |
|
Searching for Patterns in Hashtable
I have a hashtable that has been formed by reading in values from an xml
file, so I end up with a hashtable with keys and corresponding values. What
I need to do is search through for keys that begins with specific patterns,
can I use the containskey metthod with some kind of filter?
So far I am working around it using the following:-
$result = $hash1.keys | select-object | Where-Obje...
|
3 |
11/17/2008 3:25:20 PM |
|
Loading Registry hive with PowerShell
Hello,
how can I load and unload a Registry hive with PowerShell?
Of course, I could call reg.exe to load and unload my hive, but this
seems not very beautiful for me. Further, there are different versions
of reg.exe which have a different parameter ordering.
I´m trying to modify the Default User´s ntuser.dat with PowerShell.
Can anybody give some hints? Please bear with me, I´m just start...
|
2 |
11/17/2008 2:17:05 PM |
|
Server 2008 / $user.SetInfo() error
I am trying to run the simplest of Powershell scripts in Windows Server 2008.
I an trying to change the FullName property of a local user. This scripts
works fine on XP (the local user "testuser" exists on the on WS2K8 server I'm
running on):
$user = [ADSI]"WinNT://./testuser,user"
$user.Fullname="Test User"
$user.SetInfo()
When I hit the SetInfo() line, I get this error:
Except...
|
6 |
11/17/2008 2:16:04 PM |
|
excel object
To use excel object , new-object -comobject excel.application
If my machine is installed only with excel *VIEWER* and not the full-blown
excel applications, will the above object works ?
...
|
3 |
11/17/2008 2:10:42 PM |
|
help
how would i make a clock that would countdown until the new year
that would display the day hr min sec 100/sec position
starting from today date running it as script in powershell to
output to a box displayed on the screen updating it self every 100/of a sec...
please help with the source code
thanks
PS> $end=[datetime]"1/1/2009"
PS> new-timespan (get-date) $end|foreach{
...
|
2 |
11/16/2008 3:34:17 PM |