first version
This commit is contained in:
43
start.ps1
Normal file
43
start.ps1
Normal file
@@ -0,0 +1,43 @@
|
||||
####Dieses Skript ließt eine csv aus und stelllt alle Verzeichnis in der csv auf hidden
|
||||
###vars
|
||||
$ROOTFolder = "C:"
|
||||
$LogFolder = "$ROOTFolder\hidden_folder.log"
|
||||
$CSV_Read = "$PSScriptRoot\folder.csv"
|
||||
$User_Folder = "$ROOTFolder\Users\*"
|
||||
|
||||
###
|
||||
### funktion
|
||||
|
||||
function create_hidden_folder($hidden_folder){
|
||||
if (-not (Test-Path -Path "$hidden_folder" -PathType Container)) {
|
||||
$output_return_not_exist = "Error: $(Get-Date) - Das Verzeichnis $hidden_folder existiert nicht !!!"
|
||||
return "$output_return_not_exist"
|
||||
} else {
|
||||
Get-Item "$hidden_folder" -Force |foreach {
|
||||
$_.Attributes = "Hidden"
|
||||
}
|
||||
$output_retunr_works = "Info: $(Get-Date) - Das Verzeichnis $hidden_folder wurde versteckt. "
|
||||
return "$output_retunr_works"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
####Main###
|
||||
$CSV_File = Import-Csv -Path "$CSV_Read"
|
||||
foreach ($csv_out in $CSV_File)
|
||||
{
|
||||
Get-Item "$User_Folder" |foreach {
|
||||
$full_path = "$($_.FullName)\$($csv_out.Path)"
|
||||
write-host "$full_path"
|
||||
create_hidden_folder($full_path)|Out-File -FilePath $LogFolder -Append
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#create_hidden_folder("C:\test5")|Out-File -FilePath $LogFolder -Append
|
||||
Reference in New Issue
Block a user